Keyboard shortcuts

Press ← or → to navigate between chapters

Press ? to show this help

Press Esc to hide this help

문자열 편집 거리

항목값
화면 이름Edit distance
식별자levenshteinDistanceV2
지원 실행 방식Batch, Faster, Streaming
범주유사도와 거리 (Distance measurement), 문자열 (String)
반환 자료형Double | Integer

두 문자열의 편집 거리를 계산합니다. Levenshtein, indel, Damerau-Levenshtein 거리를 지원합니다.

입력 인자

이름지정 여부자료형의미와 조건
Distance function필수Enum<Damerau-Levenshtein Distance, Indel Distance, Levenshtein Distance>두 문자열의 편집 거리를 계산할 거리 함수입니다.
Ignore case필수Literal<Boolean>좌우 문자열 비교에서 대소문자를 무시할지 지정합니다.
Left필수Expression<String>비교할 왼쪽 문자열입니다.
Right필수Expression<String>비교할 오른쪽 문자열입니다.
Normalize distance선택Literal<Boolean>거리를 0~1로 정규화할지 지정합니다. 0은 차이가 없음, 1은 유사성이 없음을 뜻합니다.

입출력 예시

예시 1: 기본 동작

Levenshtein 거리로 문자열 편집 거리를 계산합니다.

인자 값:

  • Distance function: levenshtein
  • Ignore case: false
  • Left: left
  • Right: right
  • Normalize distance: false
leftright출력
hellohello0
hallohello1
hlelohello2
hellohEllO2
hellohello, world!8
hellofarewell6

예시 2: 기본 동작

ignore case를 true로 두면 대소문자가 달라도 같은 문자로 취급합니다. 이 예시는 Damerau-Levenshtein 거리를 사용합니다.

인자 값:

  • Distance function: damerau_levenshtein
  • Ignore case: true
  • Left: left
  • Right: right
  • Normalize distance: false
leftright출력
hellohello0
hallohello1
hlelohello1
hellohEllO0
hellohello, world!8
hellofarewell6

예시 3: 기본 동작

normalize를 true로 두면 편집 거리를 0~1로 정규화합니다. 이 예시는 indel 거리를 사용합니다.

인자 값:

  • Distance function: indel
  • Ignore case: false
  • Left: left
  • Right: right
  • Normalize distance: true
leftright출력
hellohello0.0
hallohello0.2
hlelohello0.2
hellohEllO0.4
hellohello, world!0.4444444444444444
hellofarewell0.5384615384615384

예시 4: null 처리

인자 값:

  • Distance function: levenshtein
  • Ignore case: false
  • Left: left
  • Right: right
  • Normalize distance: false
leftright출력
hellonullnull
nullhellonull
nullnullnull