kohangul 0.1.0 copy "kohangul: ^0.1.0" to clipboard
kohangul: ^0.1.0 copied to clipboard

Korean-text toolkit for Dart: josa (조사) particle selection, choseong (초성) search, number-to-Hangul, jamo assemble/disassemble, and batchim detection.

example/kohangul_example.dart

import 'package:kohangul/kohangul.dart';

void main() {
  // Josa (particle) selection — the most common Korean string bug.
  print(josa('사과', '이/가')); // 사과가
  print(josa('수박', '이/가')); // 수박이
  print(josa('서울', '으로/로')); // 서울로  (ㄹ exception)
  print(josa('부산', '으로/로')); // 부산으로

  // Choseong (초성) search — for autocomplete / filtering.
  print(getChoseong('안녕하세요')); // ㅇㄴㅎㅅㅇ
  final fruits = ['사과', '바나나', '수박', '딸기'];
  print(fruits.where((f) => choseongIncludes(f, 'ㅅ')).toList()); // [사과, 수박]

  // Jamo disassemble / assemble.
  print(disassemble('값')); // ㄱㅏㅂㅅ
  print(assemble(['ㅁ', 'ㅏ', 'ㄴ', 'ㅡ', 'ㄹ'])); // 마늘

  // Batchim detection.
  print(hasBatchim('강')); // true
  print(getBatchim('값')); // ㅄ

  // Number to Korean.
  print(sinoKorean(12345)); // 일만이천삼백사십오
  print(nativeKoreanCounter(20)); // 스무  → 스무 살
}
0
likes
160
points
5
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

Korean-text toolkit for Dart: josa (조사) particle selection, choseong (초성) search, number-to-Hangul, jamo assemble/disassemble, and batchim detection.

Repository (GitHub)
View/report issues

Topics

#korean #hangul #i18n #text #localization

License

MIT (license)

More

Packages that depend on kohangul