aboutsummaryrefslogtreecommitdiff
path: root/api
diff options
context:
space:
mode:
authorlonkaars <loek@pipeframe.xyz>2023-07-14 19:04:15 +0200
committerlonkaars <loek@pipeframe.xyz>2023-07-14 19:04:15 +0200
commit3dc9484fc81db8f3c8ffd4ebb4bab042e66c6214 (patch)
tree047c2d28407935c503ba6d672592bb9c67723388 /api
parent948d2311a0fdf2bb5641861824e6c629d1f2a93d (diff)
more improvements (failing tests down to 540)
Diffstat (limited to 'api')
-rw-r--r--api/japanese.ts7
-rw-r--r--api/word.ts5
2 files changed, 8 insertions, 4 deletions
diff --git a/api/japanese.ts b/api/japanese.ts
index 4f176a9..bfb04b4 100644
--- a/api/japanese.ts
+++ b/api/japanese.ts
@@ -70,14 +70,15 @@ export default class Japanese {
normalized: "",
ruby: true,
};
- var kana: boolean = this.writing[0].kanaOnly();
+ var kanji: boolean = this.writing[0].kanjiOnly(true);
for (var char of this.writing) {
- if (char.kanaOnly() != kana) {
+ var kanjiNow = char.kanjiOnly(true);
+ if (kanjiNow != kanji) {
tokens.push({ ...token });
token.writing = "";
}
token.writing += char;
- kana = char.kanaOnly();
+ kanji = kanjiNow;
}
tokens.push(token);
diff --git a/api/word.ts b/api/word.ts
index e92bc19..ff07043 100644
--- a/api/word.ts
+++ b/api/word.ts
@@ -52,7 +52,7 @@ function irregularKuru(tags: TokenTags, conjugation: string): string {
].includes(tag as any)) return "こ" + conjugation;
break;
}
- return "く" + conjugation;
+ return "くる";
}
export default class Word extends APIBase {
@@ -115,6 +115,9 @@ export default class Word extends APIBase {
}
furigana(format: JapaneseFormatter) {
+ // don't create furigana for filler/kana only terms
+ if (this.text.writing == this.text.reading) return this.text.writing;
+
return this.text.furigana(format);
}