Monday, June 23, 2025

Director, anagram, film award

Welcome back to Natural Language Puzzling, the blog where we use natural language processing and linguistics to solve the Sunday Puzzle from NPR. Here's this week's puzzle:

This week's challenge comes from listener Bob Weisz. Take the name of a major film director. Drop the last six letters of his name, and rearrange what remains. You'll get the name of a major film award -- for which this director has been nominated six times. Who is he and what is the award?

Full disclosure---this one's probably pretty easy to solve with just your brain, assuming you know a little about movies and directors. Nonetheless, let's break this down and enumerate the data and functions we'll need in order to find a solution programmatically.

  • D: a list of film directors
    • note the "he"---we're looking for male directors;
    • "drop the last six letters"---the name should probably be at least 10 letters so we have enough left over to spell an award;
    • "this director has been nominated six times"---we can probably assume the six nominations represent six different movies, so this director has at least six movies to his credit;
    • Options for acquiring this list:
      • brainstorm our own
      • search the web for a list of top directors
      • ask an LLM to provide a list of directors that meet the above criteria
        • This was my approach, and I got a pretty good list:
        • ['Steven Spielberg', 'Martin Scorsese', 'Akira Kurosawa', 'Stanley Kubrick', 'Alfred Hitchcock', 'Quentin Tarantino', 'Ridley Scott', 'Francis Ford Coppola', 'Clint Eastwood', 'Woody Allen', 'Ingmar Bergman', 'Federico Fellini', 'Billy Wilder', 'Christopher Nolan', 'Pedro Almodóvar', 'Wes Anderson', 'Paul Thomas Anderson', 'David Fincher', 'Joel Coen', 'Ethan Coen', 'Ang Lee', 'Jean-Luc Godard', 'Robert Altman', 'John Ford', 'George Lucas', 'Frank Capra', 'Roman Polanski', 'Michael Haneke', 'Ken Loach', 'Spike Lee']
  • A: a list of major film awards
    • Our options for acquiring this list are the same; here's my list:
      • ['Academy Award', 'Oscar', 'BAFTA', 'Golden Globe', 'Cannes Film Festival Award', 'Palme d Or', 'Directors Guild of America Award', 'Screen Actors Guild Award', 'Critics Choice Movie Award', 'Independent Spirit Award']
      • Obviously, some of these are unlikely solutions---we probably won't find an anagram of 'Independent Spirit Award'. 
  • anagram(word): a function for generating anagrams
    • While we've done this before, it's typically when we aren't confident that we have complete lists for solving both sides of the equation, i.e., it's an open class problem. This technically is a closed class problem, because we can't ever be certain our lists of directors or awards is complete. However, I'm confident that our lists are adequate here. This means we don't actually need to form valid anagrams with our function---we don't need to confirm that the anagram string is a real word or name in some lexicon. So, let's instead take the following approach:
  • compare(d,a):
    • The function we need is simpler than anagramming. We need to lowercase the strings, remove any spaces, punctuation, and diacritics, and remove the final 6 letters. Python can handle all that easily, and I like to use a package called slugify for changing things like "ó" to "o". Our function here doesn't need to form valid words, just sort the letters alphabetically. When we have the solution, the sorted list of letters for the director will match the sorted list for the award.
Using the above approach, I've put together a python script that is spitting out the correct solution. Have you solved the puzzle? Check back here after Thursday's NPR submission deadline (no spoilers here!) and I'll link my script and post my solution. Good luck!
The deadline for NPR submissions has passed, so click the spoiler button below to see my solution, and click here to see my script.

No comments:

Post a Comment

Director, anagram, film award

Welcome back to Natural Language Puzzling, the blog where we use natural language processing and linguistics to solve the Sunday Puzzle from...