Monday, March 11, 2024

Body parts

Note: The Natural Language Puzzling blog is wishing a speedy recovery for Puzzle Master (and fellow IU alum) Will Shortz. Rest up and get well, Will!

It's Monday, so let's tackle yesterday's Sunday Puzzle from NPR:

This week's challenge: Take a body part, add a letter at beginning and end to get another body part, then add another letter at beginning and end to get something designed to affect that body part.

Wow, this one's pretty complicated! What do we need to solve this problem?

  • B: a list of body parts
    • based on the puzzle text, I think it's safe to assume each item in this list is a single word
  • get_pairs(B): For each item in B, we can check every other item in B to see if the first item appears as a substring within the second item;
    • if so, and if the second item string has just additional letter before and after the first item, we return this pair as a candidate for the solution
  • add_letters(<string>): a function that takes a word (in our case it's a body part) and adds a letter to the beginning and end
    • we'll brute force this so the function iterates through each permutation of two letters
    • it will check a vocabulary to see if the resulting string is a word
      • if not, we abandon the string
  • V: a vocabulary
    • "something designed to affect that body part" is a little too vague to narrow this down further, especially since we don't even know what "that body part" is going to be
  • score(): we'll need a scoring function to determine if the final string makes any sense as "something to affect that body part"
    • Note that at this point, we'll have the body part that we're looking to match with a "something"; let's call this body part b
    • I'm thinking we'll just use a BERT model in masking mode; i.e., we'll use a few sentence templates like:
      • I got a new ____ for my <b>
      • I was reading about the affect of _____ on the <b> yesterday
    • The model will give us a score for each of these sentences with the candidate words filled in, so we'll take the average score and expect that the solution will be the highest scoring candidate or at least among the highest scoring.
That's going to be my approach. Do you have other ideas? I'll be back with my solution (or lack thereof) after the Thursday submission deadline. In the meantime, you can try my (partially working) python script if you want some help.

March 16, 2024 Update

The deadline has passed, so here's my solution: 

If you tried my script, you'll notice that it didn't produce a single, definitive solution. However, it does include the solution among a list of potential solutions. The tricky thing about this solution is that it isn't a single word, so we have to tokenize the string into two words, and my script wasn't really expecting this or equipped to handle it.


See you next week!

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...