Last active
September 11, 2020 13:00
-
-
Save georgepar/f6d14e6ba32b29be78b48dd8cf8e21fc to your computer and use it in GitHub Desktop.
predict_spell_checker
This file contains hidden or 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
#!/usr/bin/env bash | |
SPELL_CHECKER_COMPILED=${1} | |
python test.py | | |
fstcompile --isymbols=letter_syms.txt --osymbols=letter_syms.txt | | |
fstcompose - ${SPELL_CHECKER_COMPILED} | | |
fstshortestpath | | |
fstrmepsilon | | |
fsttopsort | | |
fstprint -osymbols=letter_syms.txt | | |
cut -f4 | | |
grep -v "<epsilon>" | | |
head -n -1 | | |
tr -d '\n' |
This file contains hidden or 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
from lib import * | |
acceptor = [] | |
s = 1 | |
letters = list('elmentery') | |
for i in range(0, len(letters)): | |
print( | |
format_arc( | |
src=s, dst=s+1, src_sym=letters[i], dst_sym=letters[i], w=0)) | |
s += 1 | |
if i == len(letters) - 1: | |
print( | |
format_arc( | |
src=s, dst=0, src_sym=EPS, dst_sym=EPS, w=0)) | |
print(0) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment