initial commit
This commit is contained in:
commit
2dc48a591c
3
README.md
Normal file
3
README.md
Normal file
@ -0,0 +1,3 @@
|
||||
# Void Stranger Tools
|
||||
|
||||
The file `english-words.txt` was gotten from https://github.com/dwyl/english-words
|
86
brute-force-word.py
Normal file
86
brute-force-word.py
Normal file
@ -0,0 +1,86 @@
|
||||
import re
|
||||
|
||||
words = []
|
||||
with open("english-words.txt", "r") as f:
|
||||
for line in f.readlines():
|
||||
line = line.strip()
|
||||
if not line.isalpha(): continue
|
||||
|
||||
words.append(line)
|
||||
|
||||
def find_word_by_letters(letters):
|
||||
pattern = ""
|
||||
for possibilities in letters:
|
||||
if len(possibilities) == 0:
|
||||
pattern += "."
|
||||
elif len(possibilities) == 0:
|
||||
pattern += possibilities[0]
|
||||
else:
|
||||
pattern += "["
|
||||
pattern += "".join(possibilities)
|
||||
pattern += "]"
|
||||
|
||||
compiled_pattern = re.compile("^" + pattern + "$")
|
||||
|
||||
found_words = []
|
||||
for word in words:
|
||||
if compiled_pattern.match(word.upper()):
|
||||
found_words.append(word)
|
||||
|
||||
return found_words
|
||||
|
||||
|
||||
letters = [
|
||||
["P"],
|
||||
["L"],
|
||||
[],
|
||||
["K", "I", "C", "A"],
|
||||
["Z", "O", "N", "K", "J"],
|
||||
["O", "M", "G", "E"],
|
||||
["Z", "Y", "X", "W", "V", "U", "T", "S", "R", "Q", "P"],
|
||||
["Y", "U", "Q", "M", "I", "E"],
|
||||
["E"],
|
||||
["D"]
|
||||
]
|
||||
|
||||
banned_words = [
|
||||
"zeed",
|
||||
"PL",
|
||||
"PLA",
|
||||
"PLT",
|
||||
"PLP",
|
||||
"plf",
|
||||
"PLC",
|
||||
"plu",
|
||||
"PLR",
|
||||
"pltano",
|
||||
"ed",
|
||||
"MED",
|
||||
"yed",
|
||||
"QED",
|
||||
"PLD",
|
||||
"Ppli",
|
||||
"ply",
|
||||
"PLL",
|
||||
"PLM",
|
||||
"pli",
|
||||
"PLO",
|
||||
"PLS",
|
||||
"PLCC",
|
||||
"SED",
|
||||
"CED"
|
||||
]
|
||||
|
||||
for split_index in range(1, len(letters)-1):
|
||||
possible_words1 = find_word_by_letters(letters[:split_index])
|
||||
if len(possible_words1) == 0: continue
|
||||
|
||||
possible_words2 = find_word_by_letters(letters[split_index:])
|
||||
if len(possible_words2) == 0: continue
|
||||
|
||||
for word1 in possible_words1:
|
||||
if word1 in banned_words: continue
|
||||
|
||||
for word2 in possible_words2:
|
||||
if word2 in banned_words: continue
|
||||
print(f"{word1} {word2}")
|
466549
english-words.txt
Normal file
466549
english-words.txt
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user