Skip to content
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

score.py goes haywire #3

Open
RobFisher opened this issue Nov 27, 2010 · 2 comments
Open

score.py goes haywire #3

RobFisher opened this issue Nov 27, 2010 · 2 comments
Labels

Comments

@RobFisher
Copy link
Owner

Sometimes making one small mistake can be interpreted as a much larger mistake. This is due to the diff algorithm used, which does not guarantee to find the smallest possible diff.

It may be necessary to implement a specialised diff algorithm rather than use difflib.

@RobFisher
Copy link
Owner Author

As an example of the problem, here's a complete session:
$ python score.py "PWLU I.T MLSS.ST IRKJ .UTTMJ IRTSLMNU SI WWLJLU ..MWITJU TPOPAP.I MOW TSMMP AKL MTLRMO PATSSW KUO MNWPSULL KOAJ WKKLP J" "pwlu i.t mlss.st irkj .uttmj irtslmnu si wwljlu ..mwitju tlli mow tsmmp l mtlrmo passw kuo mnwpsull koaj wkklp j"

PWLU I.T MLSS.ST IRKJ .UTTMJ IRTSLMNU SI WWLJLU ..MWITJU T-P+L+L+I+ +MO+W+ +T+S+M+M+P+ +L+ +M+T+L+R+M+O+ PA-P-.-I- -M-O-W- -TS-M+S-M+W-P +K+U+O+ +M+N+W+P+S+U+L+L+ +K+OA-K-L- -M-T-L-R-M-O- -P-A-T-S-S-W- -K-U-O- -M-N-W-P-S-U-L-L- -K-O-AJ WKKLP J
Mistakes: 82

The same session with characters before the first mistake removed:
$ python score.py "..MWITJU TPOPAP.I MOW TSMMP AKL MTLRMO PATSSW KUO MNWPSULL KOAJ WKKLP J" "..mwitju tlli mow tsmmp l mtlrmo passw kuo mnwpsull koaj wkklp j"

..MWITJU T-P+L+L-O-P-A-P-.I MOW TSMMP -A-KL MTLRMO PA-TSSW KUO MNWPSULL KOAJ WKKLP J
Mistakes: 10

@RobFisher
Copy link
Owner Author

I think what I want is the Levenshtein distance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant