Update structured content tests (#2134)
This commit is contained in:
parent
fd75e91e75
commit
8b206e4d04
@ -2711,5 +2711,40 @@
|
||||
"url": "<a href=\"url:\">url:</a>"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Structured content test",
|
||||
"results": [
|
||||
{
|
||||
"audio": "",
|
||||
"clipboard-image": "",
|
||||
"clipboard-text": "",
|
||||
"cloze-body": "構造",
|
||||
"cloze-prefix": "cloze-prefix",
|
||||
"cloze-suffix": "cloze-suffix",
|
||||
"conjugation": "",
|
||||
"dictionary": "Test Dictionary 2",
|
||||
"document-title": "title",
|
||||
"expression": "構造",
|
||||
"frequencies": "",
|
||||
"furigana": "<ruby>構造<rt>こうぞう</rt></ruby>",
|
||||
"furigana-plain": "構造[こうぞう]",
|
||||
"glossary": "<div style=\"text-align: left;\"><i>(n, Test Dictionary 2)</i> <ul><li>kouzou definition 1</li><li><span>kouzou definition 2</span></li><li><span lang=\"ja\">kouzou definition 3 (構造)</span></li></ul></div>",
|
||||
"glossary-brief": "<div style=\"text-align: left;\"><ul><li>kouzou definition 1</li><li><span>kouzou definition 2</span></li><li><span lang=\"ja\">kouzou definition 3 (構造)</span></li></ul></div>",
|
||||
"glossary-no-dictionary": "<div style=\"text-align: left;\"><i>(n)</i> <ul><li>kouzou definition 1</li><li><span>kouzou definition 2</span></li><li><span lang=\"ja\">kouzou definition 3 (構造)</span></li></ul></div>",
|
||||
"part-of-speech": "Noun",
|
||||
"pitch-accents": "No pitch accent data",
|
||||
"pitch-accent-graphs": "No pitch accent data",
|
||||
"pitch-accent-positions": "No pitch accent data",
|
||||
"reading": "こうぞう",
|
||||
"screenshot": "",
|
||||
"search-query": "fullQuery",
|
||||
"selection-text": "",
|
||||
"sentence": "cloze-prefix構造cloze-suffix",
|
||||
"sentence-furigana": "cloze-prefix構造cloze-suffix",
|
||||
"tags": "n",
|
||||
"url": "<a href=\"url:\">url:</a>"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
@ -307,5 +307,14 @@
|
||||
]}
|
||||
],
|
||||
100, "P E1"
|
||||
],
|
||||
[
|
||||
"構造", "こうぞう", "n", "n", 35,
|
||||
[
|
||||
"kouzou definition 1",
|
||||
{"type": "structured-content", "content": "kouzou definition 2"},
|
||||
{"type": "structured-content", "content": "kouzou definition 3 (構造)"}
|
||||
],
|
||||
101, "P E1"
|
||||
]
|
||||
]
|
@ -328,6 +328,13 @@
|
||||
"mode": "split",
|
||||
"text": "土木工事",
|
||||
"options": "default"
|
||||
},
|
||||
{
|
||||
"name": "Structured content test",
|
||||
"func": "findTerms",
|
||||
"mode": "split",
|
||||
"text": "構造",
|
||||
"options": "default"
|
||||
}
|
||||
]
|
||||
}
|
@ -28213,5 +28213,155 @@
|
||||
"media": {}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Structured content test",
|
||||
"noteDataList": [
|
||||
{
|
||||
"marker": "{marker}",
|
||||
"definition": {
|
||||
"type": "term",
|
||||
"id": 21,
|
||||
"source": "構造",
|
||||
"rawSource": "構造",
|
||||
"sourceTerm": "構造",
|
||||
"reasons": [],
|
||||
"score": 35,
|
||||
"isPrimary": true,
|
||||
"sequence": 101,
|
||||
"dictionary": "Test Dictionary 2",
|
||||
"dictionaryOrder": {
|
||||
"index": 0,
|
||||
"priority": 0
|
||||
},
|
||||
"dictionaryNames": [
|
||||
"Test Dictionary 2"
|
||||
],
|
||||
"expression": "構造",
|
||||
"reading": "こうぞう",
|
||||
"expressions": [
|
||||
{
|
||||
"sourceTerm": "構造",
|
||||
"expression": "構造",
|
||||
"reading": "こうぞう",
|
||||
"termTags": [
|
||||
{
|
||||
"name": "E1",
|
||||
"category": "default",
|
||||
"notes": "example tag 1",
|
||||
"order": 0,
|
||||
"score": 0,
|
||||
"dictionary": "Test Dictionary 2",
|
||||
"redundant": false
|
||||
},
|
||||
{
|
||||
"name": "P",
|
||||
"category": "popular",
|
||||
"notes": "popular term",
|
||||
"order": 0,
|
||||
"score": 0,
|
||||
"dictionary": "Test Dictionary 2",
|
||||
"redundant": false
|
||||
}
|
||||
],
|
||||
"frequencies": [],
|
||||
"pitches": [],
|
||||
"furiganaSegments": [
|
||||
{
|
||||
"text": "構造",
|
||||
"furigana": "こうぞう"
|
||||
}
|
||||
],
|
||||
"termFrequency": "normal",
|
||||
"wordClasses": [
|
||||
"n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"glossary": [
|
||||
"kouzou definition 1",
|
||||
{
|
||||
"type": "structured-content",
|
||||
"content": "kouzou definition 2"
|
||||
},
|
||||
{
|
||||
"type": "structured-content",
|
||||
"content": "kouzou definition 3 (構造)"
|
||||
}
|
||||
],
|
||||
"definitionTags": [
|
||||
{
|
||||
"name": "n",
|
||||
"category": "partOfSpeech",
|
||||
"notes": "noun",
|
||||
"order": 0,
|
||||
"score": 0,
|
||||
"dictionary": "Test Dictionary 2",
|
||||
"redundant": false
|
||||
}
|
||||
],
|
||||
"termTags": [
|
||||
{
|
||||
"name": "E1",
|
||||
"category": "default",
|
||||
"notes": "example tag 1",
|
||||
"order": 0,
|
||||
"score": 0,
|
||||
"dictionary": "Test Dictionary 2",
|
||||
"redundant": false
|
||||
},
|
||||
{
|
||||
"name": "P",
|
||||
"category": "popular",
|
||||
"notes": "popular term",
|
||||
"order": 0,
|
||||
"score": 0,
|
||||
"dictionary": "Test Dictionary 2",
|
||||
"redundant": false
|
||||
}
|
||||
],
|
||||
"frequencies": [],
|
||||
"pitches": [],
|
||||
"sourceTermExactMatchCount": 1,
|
||||
"url": "url:",
|
||||
"cloze": {
|
||||
"sentence": "",
|
||||
"prefix": "",
|
||||
"body": "",
|
||||
"suffix": ""
|
||||
},
|
||||
"furiganaSegments": [
|
||||
{
|
||||
"text": "構造",
|
||||
"furigana": "こうぞう"
|
||||
}
|
||||
]
|
||||
},
|
||||
"glossaryLayoutMode": "default",
|
||||
"compactTags": false,
|
||||
"group": false,
|
||||
"merge": false,
|
||||
"modeTermKanji": false,
|
||||
"modeTermKana": false,
|
||||
"modeKanji": false,
|
||||
"compactGlossaries": false,
|
||||
"uniqueExpressions": [
|
||||
"構造"
|
||||
],
|
||||
"uniqueReadings": [
|
||||
"こうぞう"
|
||||
],
|
||||
"pitches": [],
|
||||
"pitchCount": 0,
|
||||
"context": {
|
||||
"query": "query",
|
||||
"fullQuery": "fullQuery",
|
||||
"document": {
|
||||
"title": "title"
|
||||
}
|
||||
},
|
||||
"media": {}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
@ -16117,5 +16117,116 @@
|
||||
"frequencies": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Structured content test",
|
||||
"originalTextLength": 2,
|
||||
"dictionaryEntries": [
|
||||
{
|
||||
"type": "term",
|
||||
"isPrimary": true,
|
||||
"inflections": [],
|
||||
"score": 35,
|
||||
"frequencyOrder": 0,
|
||||
"dictionaryIndex": 0,
|
||||
"dictionaryPriority": 0,
|
||||
"sourceTermExactMatchCount": 1,
|
||||
"maxTransformedTextLength": 2,
|
||||
"headwords": [
|
||||
{
|
||||
"index": 0,
|
||||
"term": "構造",
|
||||
"reading": "こうぞう",
|
||||
"sources": [
|
||||
{
|
||||
"originalText": "構造",
|
||||
"transformedText": "構造",
|
||||
"deinflectedText": "構造",
|
||||
"matchType": "exact",
|
||||
"matchSource": "term",
|
||||
"isPrimary": true
|
||||
}
|
||||
],
|
||||
"tags": [
|
||||
{
|
||||
"name": "E1",
|
||||
"category": "default",
|
||||
"order": 0,
|
||||
"score": 0,
|
||||
"content": [
|
||||
"example tag 1"
|
||||
],
|
||||
"dictionaries": [
|
||||
"Test Dictionary 2"
|
||||
],
|
||||
"redundant": false
|
||||
},
|
||||
{
|
||||
"name": "P",
|
||||
"category": "popular",
|
||||
"order": 0,
|
||||
"score": 0,
|
||||
"content": [
|
||||
"popular term"
|
||||
],
|
||||
"dictionaries": [
|
||||
"Test Dictionary 2"
|
||||
],
|
||||
"redundant": false
|
||||
}
|
||||
],
|
||||
"wordClasses": [
|
||||
"n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"definitions": [
|
||||
{
|
||||
"index": 0,
|
||||
"headwordIndices": [
|
||||
0
|
||||
],
|
||||
"dictionary": "Test Dictionary 2",
|
||||
"dictionaryIndex": 0,
|
||||
"dictionaryPriority": 0,
|
||||
"id": 21,
|
||||
"score": 35,
|
||||
"frequencyOrder": 0,
|
||||
"sequences": [
|
||||
101
|
||||
],
|
||||
"isPrimary": true,
|
||||
"tags": [
|
||||
{
|
||||
"name": "n",
|
||||
"category": "partOfSpeech",
|
||||
"order": 0,
|
||||
"score": 0,
|
||||
"content": [
|
||||
"noun"
|
||||
],
|
||||
"dictionaries": [
|
||||
"Test Dictionary 2"
|
||||
],
|
||||
"redundant": false
|
||||
}
|
||||
],
|
||||
"entries": [
|
||||
"kouzou definition 1",
|
||||
{
|
||||
"type": "structured-content",
|
||||
"content": "kouzou definition 2"
|
||||
},
|
||||
{
|
||||
"type": "structured-content",
|
||||
"content": "kouzou definition 3 (構造)"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"pronunciations": [],
|
||||
"frequencies": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
@ -34,7 +34,8 @@ async function createVM() {
|
||||
const vm = new TranslatorVM({
|
||||
Node,
|
||||
NodeFilter,
|
||||
document
|
||||
document,
|
||||
location: new URL('https://yomichan.test/')
|
||||
});
|
||||
|
||||
const dictionaryDirectory = path.join(__dirname, 'data', 'dictionaries', 'valid-dictionary1');
|
||||
|
@ -155,7 +155,7 @@ async function testDatabase1() {
|
||||
media: {total: 4},
|
||||
tagMeta: {total: 15},
|
||||
termMeta: {total: 38, freq: 31, pitch: 7},
|
||||
terms: {total: 20}
|
||||
terms: {total: 21}
|
||||
}
|
||||
};
|
||||
|
||||
@ -182,8 +182,8 @@ async function testDatabase1() {
|
||||
true
|
||||
);
|
||||
vm.assert.deepStrictEqual(counts, {
|
||||
counts: [{kanji: 2, kanjiMeta: 6, terms: 20, termMeta: 38, tagMeta: 15, media: 4}],
|
||||
total: {kanji: 2, kanjiMeta: 6, terms: 20, termMeta: 38, tagMeta: 15, media: 4}
|
||||
counts: [{kanji: 2, kanjiMeta: 6, terms: 21, termMeta: 38, tagMeta: 15, media: 4}],
|
||||
total: {kanji: 2, kanjiMeta: 6, terms: 21, termMeta: 38, tagMeta: 15, media: 4}
|
||||
});
|
||||
|
||||
// Test find* functions
|
||||
|
Loading…
Reference in New Issue
Block a user