From f4963b89ee542592e9ae95ca29d74ddc57841c3f Mon Sep 17 00:00:00 2001 From: lonkaars Date: Sun, 2 Jul 2023 19:21:39 +0200 Subject: implement Japanese class --- test/api-japanese.ts | 24 ++++++++++++++++++++++++ test/halfwidth2fullwidth.ts | 5 +++++ 2 files changed, 29 insertions(+) create mode 100644 test/api-japanese.ts create mode 100644 test/halfwidth2fullwidth.ts (limited to 'test') diff --git a/test/api-japanese.ts b/test/api-japanese.ts new file mode 100644 index 0000000..86f2ac1 --- /dev/null +++ b/test/api-japanese.ts @@ -0,0 +1,24 @@ +import Japanese from "../api/japanese.ts"; + +// https://japanese.stackexchange.com/questions/69521/reading-per-kanji-irregular-readings +// wow + +var cases = [ + ["繰り返す", "くりかえす"], // [繰](く)り[返](かえ)す + ["漢字テスト", "かんじてすと"], // [漢字](かんじ)テスト + ["凛々しく", "りりしく"], // [凛々](りり)しく + ["字のテスト", "じのテスト"], // [字](じ)のテスト + ["文字", "っ"], // [漢字](っ) + ["文字りす", "りりりす"], // [文字](りり)りす + ["気を引き締める", "きをひきしめる"], // [気](き)を[引](ひ)き[締](し)める + ["文字り漢字", "りりりり"], // ????? + ["大口魚", "たら"], // [大口魚](たら) +] satisfies Array<[string, string]>; + +for (var args of cases) { + var test = new Japanese(...args as [string, string]); + // console.log(test.reading); + // console.log(test["tokenize"]()); + console.log(JSON.stringify(args) + " -> " + test.furigana("parenthesis")); +} + diff --git a/test/halfwidth2fullwidth.ts b/test/halfwidth2fullwidth.ts new file mode 100644 index 0000000..4855f7f --- /dev/null +++ b/test/halfwidth2fullwidth.ts @@ -0,0 +1,5 @@ +import "../util/japanese.ts"; + +console.log("これが オレのウィンターバケーション スタイル!".widenKatakana().katakanaToHiragana()); + + -- cgit v1.2.3