Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/yellowtoast/korean_levenshtein

Calculates similarity between two Korean strings using Levenshtein distance with decomposed phonemes, improving accuracy.
https://github.com/yellowtoast/korean_levenshtein

dart dartlang levenshtein-algorithm levenshtein-distance textsimilarity

Last synced: 27 days ago
JSON representation

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

Awesome Lists containing this project

README

        

# 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](https://flutter.dev/docs/development/packages-and-plugins/using-packages).

## Usage

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

```dart
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');
}
```