-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Look for Words within a Word #38
base: master
Are you sure you want to change the base?
Conversation
Searching words that valid in English-words.txt that contain letters from the word that you search.
Update little and add comment.
look_w.py
Outdated
import itertools, os | ||
|
||
# locate your folder that contain words.txt | ||
os.chdir("C:\\Users\\user") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this appears to be Microsoft Windows specific ... 💭
Update on replacing variable that use in local instead of global.
Small fix, so valid missing words are collected as well
remove duplicate words
fix little bug
The list of words sorted.
@kakkarja @nelsonic I think means it would be better to use a more non-platform specific directory, e.g. the use of C: drive is unique to windows and not on linux, possibly the same with the directory separators, though I am not sure able them. |
Get users default (home) directory
Fix the speed. Faster result even with long words.
Checking total num against the total letters of word.
This reverts commit 1bf0341.
Saw your pull request: dwyl#38 Wanted to show you there was a simpler way to accomplish what you were doing. Also this solution returns words in the original case.
sys imported and unused. os only used to create cwd which is implied with open try/except block that doesn't handle anything json loaded to create a more expensive defaultdict dict created just for membership testing instead of set membership test performed by fetching key value instead of using in
Simplified version of your look_w function
Searching words that valid in English-words.txt that contain letters from the word that you search.
Example:
w = look_w("insane",6)
print(w)
['insane', 'insane', 'inanes', 'inanes', 'insane', 'insane', 'inanes', 'inanes', 'sienna', 'sienna', 'sienna', 'sienna']