aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorlonkaars <loek@pipeframe.xyz>2023-07-02 19:21:39 +0200
committerlonkaars <loek@pipeframe.xyz>2023-07-02 19:21:39 +0200
commitf4963b89ee542592e9ae95ca29d74ddc57841c3f (patch)
treef9ae82ae9549330d12a30ffee8960f2577fff9aa /test
parentce9e0788317b25e5d297ed38d9fed0754a341288 (diff)
implement Japanese class
Diffstat (limited to 'test')
-rw-r--r--test/api-japanese.ts24
-rw-r--r--test/halfwidth2fullwidth.ts5
2 files changed, 29 insertions, 0 deletions
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());
+
+