Created
June 18, 2017 08:04
-
-
Save syfluqs/c188e51fa885104bdae51695bec4e2ba to your computer and use it in GitHub Desktop.
Zsh script for comparing levenshtein performance
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
#!/bin/zsh | |
source=$1 | |
q=$2 | |
echo -n "Levenshtein : " | |
python -c "import time;import Levenshtein as L;s=time.time();ret=L.ratio('$source','$q');st=time.time()-s;print(round(ret,5),st)" | |
echo -n "Relevance : " | |
python -c "import os,time;os.chdir('../kupfer-master');from kupfer.core import relevance;s=time.time();ret=relevance.score('$source','$q');st=time.time()-s;print(round(ret,5),st)" | |
echo -n "Relevance + Levenshtein : " | |
python -c "import time;import Levenshtein as L;import os;os.chdir('../kupfer-master');from kupfer.core import relevance;s=time.time();ret=(L.ratio('$source','$q')+relevance.score('$source','$q'))/2;st=time.time()-s;print(round(ret,5),st)" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment