Created
September 11, 2018 11:30
-
-
Save Rav3nPL/651078c377e530cc7af3bef8afdac1a4 to your computer and use it in GitHub Desktop.
Filtrowanie słów na potrzebę bip39 w wersji pl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
litery=[] | |
slowa=[] | |
konc2 = ["wy", "ny", "ia", "ej", "cy"] | |
konc3 = ["ski", "cki"] | |
polish = {"ą":"a", "ć":"c","ó":"o", "ż":"z", "ź":"z", "ł":"l", "ń":"n", "ę":"e", "ś":"s"} | |
lines = [line.strip() for line in open("bip39pl.txt")] | |
for slowo in lines: | |
k3 = slowo[-3:] | |
k2 = slowo[-2:] | |
if (not k2 in konc2) and (not k3 in konc3): #remove all words ended as dict | |
lit = slowo[:4] | |
for pol,asci in polish.items(): #remove all similiar beginings w/o polish letters | |
lit = lit.replace(pol,asci) | |
if not lit in litery: | |
litery.append(lit) | |
slowa.append(slowo) | |
litery=[] | |
slowa2=[] | |
for slowo in slowa: | |
if len(slowo) > 4: #remove all 4-letter words diffrent only by one letter | |
slowa2.append(slowo) | |
else: | |
lit = slowo[:3] | |
if not lit in litery: | |
litery.append(lit) | |
slowa2.append(slowo) | |
for s in slowa2: | |
print(s) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment