aboutsummaryrefslogtreecommitdiff
path: root/ext/mixed/js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2020-11-28 14:30:50 -0500
committerGitHub <noreply@github.com>2020-11-28 14:30:50 -0500
commit008ffdb6bffc2855957be948a24c9e07730501d6 (patch)
treebe6642b030011f0007aad1025da3c5accd0d9a54 /ext/mixed/js
parent94d63f4f87a61f7e42ea44d8100ea11d5ccdbce0 (diff)
Frequencies marker (#1074)
* Update japanese.js tests * Simplify fallback/early exit * Add overloads to furigana and furiganaPlain handlebars helper functions * Expose unique expression/reading arrays (and subsequently counts) * Add {frequencies} marker
Diffstat (limited to 'ext/mixed/js')
-rw-r--r--ext/mixed/js/japanese.js10
1 files changed, 6 insertions, 4 deletions
diff --git a/ext/mixed/js/japanese.js b/ext/mixed/js/japanese.js
index ee0ac777..2177ceee 100644
--- a/ext/mixed/js/japanese.js
+++ b/ext/mixed/js/japanese.js
@@ -411,9 +411,9 @@ const jp = (() => {
// Furigana distribution
distributeFurigana(expression, reading) {
- const fallback = [{furigana: reading, text: expression}];
- if (!reading) {
- return fallback;
+ if (!reading || reading === expression) {
+ // Same
+ return [{furigana: '', text: expression}];
}
let isAmbiguous = false;
@@ -471,7 +471,9 @@ const jp = (() => {
if (segments && !isAmbiguous) {
return segments;
}
- return fallback;
+
+ // Fallback
+ return [{furigana: reading, text: expression}];
}
distributeFuriganaInflected(expression, reading, source) {