1
str1 str2 str3 ...와 텍스트 파일을 가지고 있고 다른 텍스트 파일을 LD (str1, str2)로 출력하고 싶습니다. LD (str2, str3) LD (str3, str4)) 등등. 이 작업을 수행하는 방법? 어떤 언어 든 상관 없습니다.많은 연속 된 문자열 사이의 거리 Levenshtein 계산
str1 str2 str3 ...와 텍스트 파일을 가지고 있고 다른 텍스트 파일을 LD (str1, str2)로 출력하고 싶습니다. LD (str2, str3) LD (str3, str4)) 등등. 이 작업을 수행하는 방법? 어떤 언어 든 상관 없습니다.많은 연속 된 문자열 사이의 거리 Levenshtein 계산
#ASSUMING YOUR RUNNIG SOME KIND OF UNIX
#install a perl module that computes it:
sudo cpan String::Approx
# (Note: there is also Text::Levenshtein module)
# if you need to, change your shell to:
bash
# so you can use command substitution:
perl -M'String::Approx(adist)' -ane 'print adist(@F)' <(paste <(ghead -n -1 in.txt) <(gtail -n +2 in.txt))
# note: I have gnu core utils installed with 'g' prefix. You might just use 'head' and 'tail' above.