Replace furigana with reading (#1614)

* Use "reading" instead of "furigana" for reading distribution

* Update tests
This commit is contained in:
toasted-nutbread 2021-04-13 20:32:24 -04:00 committed by GitHub
parent bbf47865ff
commit 609d4fe334
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 189 additions and 185 deletions

View File

@ -1066,9 +1066,9 @@ class Backend {
const {headwords: [{term, reading}]} = dictionaryEntries[0]; const {headwords: [{term, reading}]} = dictionaryEntries[0];
const source = text.substring(i, i + originalTextLength); const source = text.substring(i, i + originalTextLength);
const textSegments = []; const textSegments = [];
for (const {text: text2, furigana} of jp.distributeFuriganaInflected(term, reading, source)) { for (const {text: text2, reading: reading2} of jp.distributeFuriganaInflected(term, reading, source)) {
const reading2 = jp.convertReading(text2, furigana, readingMode); const reading3 = jp.convertReading(text2, reading2, readingMode);
textSegments.push({text: text2, reading: reading2}); textSegments.push({text: text2, reading: reading3});
} }
results.push(textSegments); results.push(textSegments);
i += originalTextLength; i += originalTextLength;
@ -1102,13 +1102,13 @@ class Backend {
for (const line of lines) { for (const line of lines) {
for (const {term, reading, source} of line) { for (const {term, reading, source} of line) {
const termParts = []; const termParts = [];
for (const {text: text2, furigana} of jp.distributeFuriganaInflected( for (const {text: text2, reading: reading2} of jp.distributeFuriganaInflected(
term.length > 0 ? term : source, term.length > 0 ? term : source,
jp.convertKatakanaToHiragana(reading), jp.convertKatakanaToHiragana(reading),
source source
)) { )) {
const reading2 = jp.convertReading(text2, furigana, readingMode); const reading3 = jp.convertReading(text2, reading2, readingMode);
termParts.push({text: text2, reading: reading2}); termParts.push({text: text2, reading: reading3});
} }
result.push(termParts); result.push(termParts);
} }

View File

@ -596,6 +596,10 @@ class AnkiNoteDataCreator {
} }
_getTermHeadwordFuriganaSegments(term, reading) { _getTermHeadwordFuriganaSegments(term, reading) {
return this._japaneseUtil.distributeFurigana(term, reading); const result = [];
for (const {text, reading: reading2} of this._japaneseUtil.distributeFurigana(term, reading)) {
result.push({text, furigana: reading2});
}
return result;
} }
} }

View File

@ -715,13 +715,13 @@ class DisplayGenerator {
_appendFurigana(container, term, reading, addText) { _appendFurigana(container, term, reading, addText) {
container.lang = 'ja'; container.lang = 'ja';
const segments = this._japaneseUtil.distributeFurigana(term, reading); const segments = this._japaneseUtil.distributeFurigana(term, reading);
for (const {text, furigana} of segments) { for (const {text, reading: reading2} of segments) {
if (furigana) { if (reading2) {
const ruby = document.createElement('ruby'); const ruby = document.createElement('ruby');
const rt = document.createElement('rt'); const rt = document.createElement('rt');
addText(ruby, text); addText(ruby, text);
ruby.appendChild(rt); ruby.appendChild(rt);
rt.appendChild(document.createTextNode(furigana)); rt.appendChild(document.createTextNode(reading2));
container.appendChild(ruby); container.appendChild(ruby);
} else { } else {
addText(container, text); addText(container, text);

View File

@ -507,7 +507,7 @@ const JapaneseUtil = (() => {
if (stemLength < source.length) { if (stemLength < source.length) {
const remainder = source.substring(stemLength); const remainder = source.substring(stemLength);
const segmentCount = segments.length; const segmentCount = segments.length;
if (segmentCount > 0 && segments[segmentCount - 1].furigana.length === 0) { if (segmentCount > 0 && segments[segmentCount - 1].reading.length === 0) {
// Append to the last segment if it has an empty reading // Append to the last segment if it has an empty reading
segments[segmentCount - 1].text += remainder; segments[segmentCount - 1].text += remainder;
} else { } else {
@ -554,8 +554,8 @@ const JapaneseUtil = (() => {
// Private // Private
_createFuriganaSegment(text, furigana) { _createFuriganaSegment(text, reading) {
return {text, furigana}; return {text, reading};
} }
_segmentizeFurigana(reading, readingNormalized, groups, groupsStart) { _segmentizeFurigana(reading, readingNormalized, groups, groupsStart) {
@ -600,8 +600,8 @@ const JapaneseUtil = (() => {
// More than one way to segmentize the tail; mark as ambiguous // More than one way to segmentize the tail; mark as ambiguous
return null; return null;
} }
const furigana = reading.substring(0, i); const segmentReading = reading.substring(0, i);
segments.unshift(this._createFuriganaSegment(text, furigana)); segments.unshift(this._createFuriganaSegment(text, segmentReading));
result = segments; result = segments;
} }
// There is only one way to segmentize the last non-kana group // There is only one way to segmentize the last non-kana group

View File

@ -177,11 +177,11 @@ class TemplateRenderer {
const segs = this._japaneseUtil.distributeFurigana(expression, reading); const segs = this._japaneseUtil.distributeFurigana(expression, reading);
let result = ''; let result = '';
for (const seg of segs) { for (const {text, reading: reading2} of segs) {
if (seg.furigana.length > 0) { if (reading2.length > 0) {
result += `<ruby>${seg.text}<rt>${seg.furigana}</rt></ruby>`; result += `<ruby>${text}<rt>${reading2}</rt></ruby>`;
} else { } else {
result += seg.text; result += text;
} }
} }
@ -193,12 +193,12 @@ class TemplateRenderer {
const segs = this._japaneseUtil.distributeFurigana(expression, reading); const segs = this._japaneseUtil.distributeFurigana(expression, reading);
let result = ''; let result = '';
for (const seg of segs) { for (const {text, reading: reading2} of segs) {
if (seg.furigana.length > 0) { if (reading2.length > 0) {
if (result.length > 0) { result += ' '; } if (result.length > 0) { result += ' '; }
result += `${seg.text}[${seg.furigana}]`; result += `${text}[${reading2}]`;
} else { } else {
result += seg.text; result += text;
} }
} }

View File

@ -278,441 +278,441 @@ function testDistributeFurigana() {
[ [
['有り難う', 'ありがとう'], ['有り難う', 'ありがとう'],
[ [
{text: '有', furigana: 'あ'}, {text: '有', reading: 'あ'},
{text: 'り', furigana: ''}, {text: 'り', reading: ''},
{text: '難', furigana: 'がと'}, {text: '難', reading: 'がと'},
{text: 'う', furigana: ''} {text: 'う', reading: ''}
] ]
], ],
[ [
['方々', 'かたがた'], ['方々', 'かたがた'],
[ [
{text: '方々', furigana: 'かたがた'} {text: '方々', reading: 'かたがた'}
] ]
], ],
[ [
['お祝い', 'おいわい'], ['お祝い', 'おいわい'],
[ [
{text: 'お', furigana: ''}, {text: 'お', reading: ''},
{text: '祝', furigana: 'いわ'}, {text: '祝', reading: 'いわ'},
{text: 'い', furigana: ''} {text: 'い', reading: ''}
] ]
], ],
[ [
['美味しい', 'おいしい'], ['美味しい', 'おいしい'],
[ [
{text: '美味', furigana: 'おい'}, {text: '美味', reading: 'おい'},
{text: 'しい', furigana: ''} {text: 'しい', reading: ''}
] ]
], ],
[ [
['食べ物', 'たべもの'], ['食べ物', 'たべもの'],
[ [
{text: '食', furigana: 'た'}, {text: '食', reading: 'た'},
{text: 'べ', furigana: ''}, {text: 'べ', reading: ''},
{text: '物', furigana: 'もの'} {text: '物', reading: 'もの'}
] ]
], ],
[ [
['試し切り', 'ためしぎり'], ['試し切り', 'ためしぎり'],
[ [
{text: '試', furigana: 'ため'}, {text: '試', reading: 'ため'},
{text: 'し', furigana: ''}, {text: 'し', reading: ''},
{text: '切', furigana: 'ぎ'}, {text: '切', reading: 'ぎ'},
{text: 'り', furigana: ''} {text: 'り', reading: ''}
] ]
], ],
// Ambiguous // Ambiguous
[ [
['飼い犬', 'かいいぬ'], ['飼い犬', 'かいいぬ'],
[ [
{text: '飼い犬', furigana: 'かいいぬ'} {text: '飼い犬', reading: 'かいいぬ'}
] ]
], ],
[ [
['長い間', 'ながいあいだ'], ['長い間', 'ながいあいだ'],
[ [
{text: '長い間', furigana: 'ながいあいだ'} {text: '長い間', reading: 'ながいあいだ'}
] ]
], ],
// Same/empty reading // Same/empty reading
[ [
['飼い犬', ''], ['飼い犬', ''],
[ [
{text: '飼い犬', furigana: ''} {text: '飼い犬', reading: ''}
] ]
], ],
[ [
['かいいぬ', 'かいいぬ'], ['かいいぬ', 'かいいぬ'],
[ [
{text: 'かいいぬ', furigana: ''} {text: 'かいいぬ', reading: ''}
] ]
], ],
[ [
['かいぬ', 'かいぬ'], ['かいぬ', 'かいぬ'],
[ [
{text: 'かいぬ', furigana: ''} {text: 'かいぬ', reading: ''}
] ]
], ],
// Misc // Misc
[ [
['月', 'か'], ['月', 'か'],
[ [
{text: '月', furigana: 'か'} {text: '月', reading: 'か'}
] ]
], ],
[ [
['月', 'カ'], ['月', 'カ'],
[ [
{text: '月', furigana: 'カ'} {text: '月', reading: 'カ'}
] ]
], ],
// Mismatched kana readings // Mismatched kana readings
[ [
['有り難う', 'アリガトウ'], ['有り難う', 'アリガトウ'],
[ [
{text: '有', furigana: 'ア'}, {text: '有', reading: 'ア'},
{text: 'り', furigana: 'リ'}, {text: 'り', reading: 'リ'},
{text: '難', furigana: 'ガト'}, {text: '難', reading: 'ガト'},
{text: 'う', furigana: 'ウ'} {text: 'う', reading: 'ウ'}
] ]
], ],
[ [
['ありがとう', 'アリガトウ'], ['ありがとう', 'アリガトウ'],
[ [
{text: 'ありがとう', furigana: 'アリガトウ'} {text: 'ありがとう', reading: 'アリガトウ'}
] ]
], ],
// Mismatched kana readings (real examples) // Mismatched kana readings (real examples)
[ [
['カ月', 'かげつ'], ['カ月', 'かげつ'],
[ [
{text: 'カ', furigana: 'か'}, {text: 'カ', reading: 'か'},
{text: '月', furigana: 'げつ'} {text: '月', reading: 'げつ'}
] ]
], ],
[ [
['序ノ口', 'じょのくち'], ['序ノ口', 'じょのくち'],
[ [
{text: '序', furigana: 'じょ'}, {text: '序', reading: 'じょ'},
{text: '', furigana: 'の'}, {text: '', reading: 'の'},
{text: '口', furigana: 'くち'} {text: '口', reading: 'くち'}
] ]
], ],
[ [
['スズメの涙', 'すずめのなみだ'], ['スズメの涙', 'すずめのなみだ'],
[ [
{text: 'スズメ', furigana: 'すずめ'}, {text: 'スズメ', reading: 'すずめ'},
{text: 'の', furigana: ''}, {text: 'の', reading: ''},
{text: '涙', furigana: 'なみだ'} {text: '涙', reading: 'なみだ'}
] ]
], ],
[ [
['二カ所', 'にかしょ'], ['二カ所', 'にかしょ'],
[ [
{text: '二', furigana: 'に'}, {text: '二', reading: 'に'},
{text: 'カ', furigana: 'か'}, {text: 'カ', reading: 'か'},
{text: '所', furigana: 'しょ'} {text: '所', reading: 'しょ'}
] ]
], ],
[ [
['八ツ橋', 'やつはし'], ['八ツ橋', 'やつはし'],
[ [
{text: '八', furigana: 'や'}, {text: '八', reading: 'や'},
{text: 'ツ', furigana: 'つ'}, {text: 'ツ', reading: 'つ'},
{text: '橋', furigana: 'はし'} {text: '橋', reading: 'はし'}
] ]
], ],
[ [
['八ツ橋', 'やつはし'], ['八ツ橋', 'やつはし'],
[ [
{text: '八', furigana: 'や'}, {text: '八', reading: 'や'},
{text: 'ツ', furigana: 'つ'}, {text: 'ツ', reading: 'つ'},
{text: '橋', furigana: 'はし'} {text: '橋', reading: 'はし'}
] ]
], ],
[ [
['一カ月', 'いっかげつ'], ['一カ月', 'いっかげつ'],
[ [
{text: '一', furigana: 'いっ'}, {text: '一', reading: 'いっ'},
{text: 'カ', furigana: 'か'}, {text: 'カ', reading: 'か'},
{text: '月', furigana: 'げつ'} {text: '月', reading: 'げつ'}
] ]
], ],
[ [
['一カ所', 'いっかしょ'], ['一カ所', 'いっかしょ'],
[ [
{text: '一', furigana: 'いっ'}, {text: '一', reading: 'いっ'},
{text: 'カ', furigana: 'か'}, {text: 'カ', reading: 'か'},
{text: '所', furigana: 'しょ'} {text: '所', reading: 'しょ'}
] ]
], ],
[ [
['カ所', 'かしょ'], ['カ所', 'かしょ'],
[ [
{text: 'カ', furigana: 'か'}, {text: 'カ', reading: 'か'},
{text: '所', furigana: 'しょ'} {text: '所', reading: 'しょ'}
] ]
], ],
[ [
['数カ月', 'すうかげつ'], ['数カ月', 'すうかげつ'],
[ [
{text: '数', furigana: 'すう'}, {text: '数', reading: 'すう'},
{text: 'カ', furigana: 'か'}, {text: 'カ', reading: 'か'},
{text: '月', furigana: 'げつ'} {text: '月', reading: 'げつ'}
] ]
], ],
[ [
['くノ一', 'くのいち'], ['くノ一', 'くのいち'],
[ [
{text: 'く', furigana: ''}, {text: 'く', reading: ''},
{text: '', furigana: 'の'}, {text: '', reading: 'の'},
{text: '一', furigana: 'いち'} {text: '一', reading: 'いち'}
] ]
], ],
[ [
['くノ一', 'くのいち'], ['くノ一', 'くのいち'],
[ [
{text: 'く', furigana: ''}, {text: 'く', reading: ''},
{text: '', furigana: 'の'}, {text: '', reading: 'の'},
{text: '一', furigana: 'いち'} {text: '一', reading: 'いち'}
] ]
], ],
[ [
['数カ国', 'すうかこく'], ['数カ国', 'すうかこく'],
[ [
{text: '数', furigana: 'すう'}, {text: '数', reading: 'すう'},
{text: 'カ', furigana: 'か'}, {text: 'カ', reading: 'か'},
{text: '国', furigana: 'こく'} {text: '国', reading: 'こく'}
] ]
], ],
[ [
['数カ所', 'すうかしょ'], ['数カ所', 'すうかしょ'],
[ [
{text: '数', furigana: 'すう'}, {text: '数', reading: 'すう'},
{text: 'カ', furigana: 'か'}, {text: 'カ', reading: 'か'},
{text: '所', furigana: 'しょ'} {text: '所', reading: 'しょ'}
] ]
], ],
[ [
['壇ノ浦の戦い', 'だんのうらのたたかい'], ['壇ノ浦の戦い', 'だんのうらのたたかい'],
[ [
{text: '壇', furigana: 'だん'}, {text: '壇', reading: 'だん'},
{text: '', furigana: 'の'}, {text: '', reading: 'の'},
{text: '浦', furigana: 'うら'}, {text: '浦', reading: 'うら'},
{text: 'の', furigana: ''}, {text: 'の', reading: ''},
{text: '戦', furigana: 'たたか'}, {text: '戦', reading: 'たたか'},
{text: 'い', furigana: ''} {text: 'い', reading: ''}
] ]
], ],
[ [
['壇ノ浦の戦', 'だんのうらのたたかい'], ['壇ノ浦の戦', 'だんのうらのたたかい'],
[ [
{text: '壇', furigana: 'だん'}, {text: '壇', reading: 'だん'},
{text: '', furigana: 'の'}, {text: '', reading: 'の'},
{text: '浦', furigana: 'うら'}, {text: '浦', reading: 'うら'},
{text: 'の', furigana: ''}, {text: 'の', reading: ''},
{text: '戦', furigana: 'たたかい'} {text: '戦', reading: 'たたかい'}
] ]
], ],
[ [
['序ノ口格', 'じょのくちかく'], ['序ノ口格', 'じょのくちかく'],
[ [
{text: '序', furigana: 'じょ'}, {text: '序', reading: 'じょ'},
{text: '', furigana: 'の'}, {text: '', reading: 'の'},
{text: '口格', furigana: 'くちかく'} {text: '口格', reading: 'くちかく'}
] ]
], ],
[ [
['二カ国語', 'にかこくご'], ['二カ国語', 'にかこくご'],
[ [
{text: '二', furigana: 'に'}, {text: '二', reading: 'に'},
{text: 'カ', furigana: 'か'}, {text: 'カ', reading: 'か'},
{text: '国語', furigana: 'こくご'} {text: '国語', reading: 'こくご'}
] ]
], ],
[ [
['カ国', 'かこく'], ['カ国', 'かこく'],
[ [
{text: 'カ', furigana: 'か'}, {text: 'カ', reading: 'か'},
{text: '国', furigana: 'こく'} {text: '国', reading: 'こく'}
] ]
], ],
[ [
['カ国語', 'かこくご'], ['カ国語', 'かこくご'],
[ [
{text: 'カ', furigana: 'か'}, {text: 'カ', reading: 'か'},
{text: '国語', furigana: 'こくご'} {text: '国語', reading: 'こくご'}
] ]
], ],
[ [
['壇ノ浦の合戦', 'だんのうらのかっせん'], ['壇ノ浦の合戦', 'だんのうらのかっせん'],
[ [
{text: '壇', furigana: 'だん'}, {text: '壇', reading: 'だん'},
{text: '', furigana: 'の'}, {text: '', reading: 'の'},
{text: '浦', furigana: 'うら'}, {text: '浦', reading: 'うら'},
{text: 'の', furigana: ''}, {text: 'の', reading: ''},
{text: '合戦', furigana: 'かっせん'} {text: '合戦', reading: 'かっせん'}
] ]
], ],
[ [
['一タ偏', 'いちたへん'], ['一タ偏', 'いちたへん'],
[ [
{text: '一', furigana: 'いち'}, {text: '一', reading: 'いち'},
{text: 'タ', furigana: 'た'}, {text: 'タ', reading: 'た'},
{text: '偏', furigana: 'へん'} {text: '偏', reading: 'へん'}
] ]
], ],
[ [
['ル又', 'るまた'], ['ル又', 'るまた'],
[ [
{text: 'ル', furigana: 'る'}, {text: 'ル', reading: 'る'},
{text: '又', furigana: 'また'} {text: '又', reading: 'また'}
] ]
], ],
[ [
['ノ木偏', 'のぎへん'], ['ノ木偏', 'のぎへん'],
[ [
{text: '', furigana: 'の'}, {text: '', reading: 'の'},
{text: '木偏', furigana: 'ぎへん'} {text: '木偏', reading: 'ぎへん'}
] ]
], ],
[ [
['一ノ貝', 'いちのかい'], ['一ノ貝', 'いちのかい'],
[ [
{text: '一', furigana: 'いち'}, {text: '一', reading: 'いち'},
{text: '', furigana: 'の'}, {text: '', reading: 'の'},
{text: '貝', furigana: 'かい'} {text: '貝', reading: 'かい'}
] ]
], ],
[ [
['虎ノ門事件', 'とらのもんじけん'], ['虎ノ門事件', 'とらのもんじけん'],
[ [
{text: '虎', furigana: 'とら'}, {text: '虎', reading: 'とら'},
{text: '', furigana: 'の'}, {text: '', reading: 'の'},
{text: '門事件', furigana: 'もんじけん'} {text: '門事件', reading: 'もんじけん'}
] ]
], ],
[ [
['教育ニ関スル勅語', 'きょういくにかんするちょくご'], ['教育ニ関スル勅語', 'きょういくにかんするちょくご'],
[ [
{text: '教育', furigana: 'きょういく'}, {text: '教育', reading: 'きょういく'},
{text: 'ニ', furigana: 'に'}, {text: 'ニ', reading: 'に'},
{text: '関', furigana: 'かん'}, {text: '関', reading: 'かん'},
{text: 'スル', furigana: 'する'}, {text: 'スル', reading: 'する'},
{text: '勅語', furigana: 'ちょくご'} {text: '勅語', reading: 'ちょくご'}
] ]
], ],
[ [
['二カ年', 'にかねん'], ['二カ年', 'にかねん'],
[ [
{text: '二', furigana: 'に'}, {text: '二', reading: 'に'},
{text: 'カ', furigana: 'か'}, {text: 'カ', reading: 'か'},
{text: '年', furigana: 'ねん'} {text: '年', reading: 'ねん'}
] ]
], ],
[ [
['三カ年', 'さんかねん'], ['三カ年', 'さんかねん'],
[ [
{text: '三', furigana: 'さん'}, {text: '三', reading: 'さん'},
{text: 'カ', furigana: 'か'}, {text: 'カ', reading: 'か'},
{text: '年', furigana: 'ねん'} {text: '年', reading: 'ねん'}
] ]
], ],
[ [
['四カ年', 'よんかねん'], ['四カ年', 'よんかねん'],
[ [
{text: '四', furigana: 'よん'}, {text: '四', reading: 'よん'},
{text: 'カ', furigana: 'か'}, {text: 'カ', reading: 'か'},
{text: '年', furigana: 'ねん'} {text: '年', reading: 'ねん'}
] ]
], ],
[ [
['五カ年', 'ごかねん'], ['五カ年', 'ごかねん'],
[ [
{text: '五', furigana: 'ご'}, {text: '五', reading: 'ご'},
{text: 'カ', furigana: 'か'}, {text: 'カ', reading: 'か'},
{text: '年', furigana: 'ねん'} {text: '年', reading: 'ねん'}
] ]
], ],
[ [
['六カ年', 'ろっかねん'], ['六カ年', 'ろっかねん'],
[ [
{text: '六', furigana: 'ろっ'}, {text: '六', reading: 'ろっ'},
{text: 'カ', furigana: 'か'}, {text: 'カ', reading: 'か'},
{text: '年', furigana: 'ねん'} {text: '年', reading: 'ねん'}
] ]
], ],
[ [
['七カ年', 'ななかねん'], ['七カ年', 'ななかねん'],
[ [
{text: '七', furigana: 'なな'}, {text: '七', reading: 'なな'},
{text: 'カ', furigana: 'か'}, {text: 'カ', reading: 'か'},
{text: '年', furigana: 'ねん'} {text: '年', reading: 'ねん'}
] ]
], ],
[ [
['八カ年', 'はちかねん'], ['八カ年', 'はちかねん'],
[ [
{text: '八', furigana: 'はち'}, {text: '八', reading: 'はち'},
{text: 'カ', furigana: 'か'}, {text: 'カ', reading: 'か'},
{text: '年', furigana: 'ねん'} {text: '年', reading: 'ねん'}
] ]
], ],
[ [
['九カ年', 'きゅうかねん'], ['九カ年', 'きゅうかねん'],
[ [
{text: '九', furigana: 'きゅう'}, {text: '九', reading: 'きゅう'},
{text: 'カ', furigana: 'か'}, {text: 'カ', reading: 'か'},
{text: '年', furigana: 'ねん'} {text: '年', reading: 'ねん'}
] ]
], ],
[ [
['十カ年', 'じゅうかねん'], ['十カ年', 'じゅうかねん'],
[ [
{text: '十', furigana: 'じゅう'}, {text: '十', reading: 'じゅう'},
{text: 'カ', furigana: 'か'}, {text: 'カ', reading: 'か'},
{text: '年', furigana: 'ねん'} {text: '年', reading: 'ねん'}
] ]
], ],
[ [
['鏡ノ間', 'かがみのま'], ['鏡ノ間', 'かがみのま'],
[ [
{text: '鏡', furigana: 'かがみ'}, {text: '鏡', reading: 'かがみ'},
{text: '', furigana: 'の'}, {text: '', reading: 'の'},
{text: '間', furigana: 'ま'} {text: '間', reading: 'ま'}
] ]
], ],
[ [
['鏡ノ間', 'かがみのま'], ['鏡ノ間', 'かがみのま'],
[ [
{text: '鏡', furigana: 'かがみ'}, {text: '鏡', reading: 'かがみ'},
{text: '', furigana: 'の'}, {text: '', reading: 'の'},
{text: '間', furigana: 'ま'} {text: '間', reading: 'ま'}
] ]
], ],
[ [
['ページ違反', 'ぺーじいはん'], ['ページ違反', 'ぺーじいはん'],
[ [
{text: 'ペ', furigana: 'ぺ'}, {text: 'ペ', reading: 'ぺ'},
{text: 'ー', furigana: ''}, {text: 'ー', reading: ''},
{text: 'ジ', furigana: 'じ'}, {text: 'ジ', reading: 'じ'},
{text: '違反', furigana: 'いはん'} {text: '違反', reading: 'いはん'}
] ]
], ],
// Mismatched kana // Mismatched kana
[ [
['サボる', 'サボル'], ['サボる', 'サボル'],
[ [
{text: 'サボ', furigana: ''}, {text: 'サボ', reading: ''},
{text: 'る', furigana: 'ル'} {text: 'る', reading: 'ル'}
] ]
], ],
// Reading starts with term, but has remainder characters // Reading starts with term, but has remainder characters
[ [
['シック', 'シック・ビルしょうこうぐん'], ['シック', 'シック・ビルしょうこうぐん'],
[ [
{text: 'シック', furigana: 'シック・ビルしょうこうぐん'} {text: 'シック', reading: 'シック・ビルしょうこうぐん'}
] ]
] ]
]; ];
@ -728,40 +728,40 @@ function testDistributeFuriganaInflected() {
[ [
['美味しい', 'おいしい', '美味しかた'], ['美味しい', 'おいしい', '美味しかた'],
[ [
{text: '美味', furigana: 'おい'}, {text: '美味', reading: 'おい'},
{text: 'しかた', furigana: ''} {text: 'しかた', reading: ''}
] ]
], ],
[ [
['食べる', 'たべる', '食べた'], ['食べる', 'たべる', '食べた'],
[ [
{text: '食', furigana: 'た'}, {text: '食', reading: 'た'},
{text: 'べた', furigana: ''} {text: 'べた', reading: ''}
] ]
], ],
[ [
['迄に', 'までに', 'までに'], ['迄に', 'までに', 'までに'],
[ [
{text: 'までに', furigana: ''} {text: 'までに', reading: ''}
] ]
], ],
[ [
['行う', 'おこなう', 'おこなわなかった'], ['行う', 'おこなう', 'おこなわなかった'],
[ [
{text: 'おこなわなかった', furigana: ''} {text: 'おこなわなかった', reading: ''}
] ]
], ],
[ [
['いい', 'いい', 'イイ'], ['いい', 'いい', 'イイ'],
[ [
{text: 'イイ', furigana: ''} {text: 'イイ', reading: ''}
] ]
], ],
[ [
['否か', 'いなか', '否カ'], ['否か', 'いなか', '否カ'],
[ [
{text: '否', furigana: 'いな'}, {text: '否', reading: 'いな'},
{text: 'カ', furigana: 'か'} {text: 'カ', reading: 'か'}
] ]
] ]
]; ];