Skip to content

Calculates similarity between two Korean strings using Levenshtein distance with decomposed phonemes, improving accuracy.

License

Notifications You must be signed in to change notification settings

Yellowtoast/korean_levenshtein

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

KoreanLevenshtein

The KoreanLevenshtein algorithm is a modification of the traditional Levenshtein distance algorithm, specifically tailored to handle Korean text. It calculates the similarity between two Korean strings by measuring the difference in their characters, accounting for the nuances of the Korean language, such as decomposed phonemes and special characters.

Features

  • Decomposed Phonemes Handling: Korean characters consist of decomposed phonemes, namely, chosung, jungsung, and jongsung. The algorithm decomposes each character into its constituent phonemes, allowing for a more accurate comparison.

  • Numeric Character Replacement: Optionally replaces numeric characters with their Korean representations, ensuring uniformity in text comparison regardless of numeric presence.

  • Special Character Replacement: Optionally replaces special characters with their Korean speech equivalents, facilitating consistent comparison by considering special characters as part of the language.

  • Customized Phoneme Weights: Allows users to customize the weights assigned to different phonemes, enabling fine-tuning of the comparison process based on specific requirements.

Getting Started

To use this package, add korean_levenshtein as a dependency in your pubspec.yaml file.

Usage

The KoreanLevenshtein algorithm provides functions for text comparison. Below is an example of how to use it:

import 'package:korean_levenshtein/korean_levenshtein.dart';

void main() {
  // Example usage of jamoSimilarityPercentage function
  double similarity = KoreanLevenshtein.jamoSimilarityPercentage(
    '안녕하세요',
    '안녕하십니까?',
    replaceNumberToKorean: true,
    replaceSpecialCharToKorean: true,
  );

  print('Similarity Percentage: $similarity');
}

About

Calculates similarity between two Korean strings using Levenshtein distance with decomposed phonemes, improving accuracy.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages