""" # Any word with 7 unique letters is a pangram The first letter of the string of allowed letters is the key letter that must be contained in all the words.ĭef find_pangrams ( good_words, n = 7 ): """Return a list of pangrams (ie words containing all allowed letters)įrom a list of words. It will return True if the word meets the criteria and False if not. The first function we will write, check_word(), will check if a given word meets the criteria for the game. Once we have the word list, we need code to check if words in the list are good words. It seems like the Norvig list is working well, but I am open to suggestions for improvement. The performance of the app is dependent on the word list so it’s important to pick a good one. I got much better results from Peter Norvig’s word list. The NLTK list is full of proper nouns and words that the NYT puzzle editors deem obscure. This worked ok, but it returned too many false positive results. At first I tried the Natural Language Toolkit (NLTK) corpus word list: from rpus import words. No “obscure,” hyphenated, or proper nounsįirst we will need a list of words.Words must include the center, “key”, letter.The basic idea will be to scan through a list of English words and check each word to see if it meets the criteria. Separating this code from the rest of the app will make it easier to experiment with and change how I get inputs and deliver results to the users. This will be a Python module that contains the core functionality of the app: finding words that meet the criteria for the game. The first step in making the app is to define the business logic. I’m using git and GitHub for this project which is the standard set of tools for open source projects. It also makes it easy to store your code in the cloud to facilitate sharing it with others and safe backups. It allows you to keep track of revisions to a project and to test out new features without affecting the working, main version of the code. Version control is a system for tracking changes to a code base. But even when working alone, it’s useful to know. It’s a necessary skill to have if you are collaborating with a team. When working on a programming project, version control is something important to understand. I exposed the functions in a REST API using Flask (also unit tested), and deployed it into a container running on the Raspberry Pi. I wrote unit tests along the way and incorporated them into a Continuous Integration build and test pipeline using GitHub Actions. I developed the app with Python in a Docker container using Git version control. This way I can access the app from my phone as long as I’m connected to my home wifi network.īuilding this app is a nice opportunity to practice and write about some of the software development and skills I have been learning. Currently I have the app running on a web server on my Raspberry Pi at home. It also identifies any of the words that are pangrams. I built a web app in Python where I enter in the letters of the puzzle, and it returns a list of words that meet the criteria of the game. ![]() So I had to come up with a way to “improve” (It’s not cheating if you write the code yourself…right?) The only problem is Sarah is better at it than me. It’s a fun puzzle that’s a nice daily break from everything else going on in our world. ![]() You get more points for longer words, and pangrams, words that use all seven letters at least once, are worth a bonus. There is also a “center letter” which must be included in each word. ![]() The challenge is to come up with as many words as you can that are spelled using only those letters. Every day, they release a new puzzle with seven letters. Lately Sarah and I have been enjoying solving the Spelling Bee Puzzle from the New York Times. Be sure to check out Part 2 of this series to read about my experience with that platform. ![]() UPDATE: The app described in this post is now live with a front-end built using the streamlit framework and is hosted on Streamlit Sharing.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |