1 / 13

Edit distance

Edit distance. Beginning of Edit Distance. Levenshtein distance 는 러시아 과학자인 Vladimir Levenshtein 가 1965 년에 고안하여 그렇게 이름이 지어졌다 . Levenshtein 이란 단어가 쓰거나 읽기 힘들기 때문에 종종 edit distance 라고도 불린 다. What is Edit Distance?.

Download Presentation

Edit distance

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Edit distance

  2. Beginning of Edit Distance • Levenshtein distance는 러시아 과학자인 Vladimir Levenshtein가 1965년에 고안하여 그렇게 이름이 지어졌다. • Levenshtein이란 단어가 쓰거나 읽기 힘들기 때문에 종종 edit distance라고도 불린다.

  3. What is Edit Distance? • "edit distance between two strings of characters is the number of operations required to transform one of them into the other."두 문자열간의 edit distance는 하나의 문자열을 다른 하나의 문자열로 변환하기 위해 요구되어지는 연산의 수이다. • [wikipedia발췌]

  4. String Operation • 변환, 삽입, 삭제 • (그냥 복사하는 것은 0번의 연산)

  5. String Operation ex. • abc abd: c를 d로 변환(1번 연산 : 거리 1) • 2. park  spake: 최적의 거리는 3 [방법 1] s를삽입 r을 k로 변환 k를 e로 변환 (3번 연산 : 거리 3) - p a r ks p a k e [방법 2] p를 s로 변환 a를 p로 변환 r를 p로 변환 e를 삽입 (4번 연산 : 거리 4) p a r k -s p a k e

  6. Algorithm Process[1] • <1> • s의 문자열 길이를 n에 넣는다.t의 문자열의 길이를 m에 넣는다.만약 n = 0 이라면, m 을 리턴하고 종료한다.만약 m = 0 이라면, n 을 리턴하고 종료한다.0..m 행과, 0..n 열로 이루어진 행열을 만든다.

  7. Algorithm Process[2] • <2>첫번째 행인 0..n을 초기화 한다.첫번째 열인 0..m을 초기화 한다.<3>s의 각 문자(i는 1부터 n까지)를 검사한다.<4>t의 각 문자(j는 1부터 m까지)를 검사한다.

  8. Algorithm Process[3] • <5>s[i]와 t[j]가 같다면, 변경하기 위한 비용은 0이 된다.s[i]와 t[j]가 같지 않다면, 비용은 1이 된다.<6>행열의 셀 d[i,j]에 다음의 것들 중 가장 작은 값을 넣는다.a. 바로 위의 셀이 더하기 1이 되는 경우: d[i-1, j] + 1b. 바로 왼쪽 셀이 더하기 일이 되는 경우: d[i,j-1] + 1c. 대각선으로 연속적인, 바로 왼,위쪽 셀의 비용: d[i-1,j-1] + cost<7>(3, 4, 5, 6) 단계를 반복하여 완료되면, d[n, m]셀에 있는 것이 distance가 된다.

  9. Edit Distance Matrix src(i)와 dst(j)가 같으면 초록색 칸 값, 다르면 초록, 빨강, 주황 칸 값 중 가장 작은 값 +1 삽입 복사 / 변환 삭 제

  10. Edit Distance Matrix< park spake > S 삽입(연산 1) P 복사(연산 1) Edit distance 는 3 A 복사(연산 1) R  k변환 (연산 2) K  E 변환 (연산 3)

  11. Major Application Field • - 철자 검사- 음성 인식- DNA 분석- 표절여부 검사

  12. How do We Use Edit Distance? • 사전 DB와 사용자가 입력한 단어의비슷한 정도를 알아내기 위해 edit distance를 사용.

  13. [Source] • http://danamoni.tistory.com/entry/Edit-Distance-Edit-Operations-using-Dynamic-Programming • http://people.cs.umass.edu/~mccallum/courses/cl2006/lect4-stredit.pdf • http://progh2.tistory.com/195

More Related