Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add phonetic transcriptions term meta type #434

Merged
merged 24 commits into from
Dec 28, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add tests
  • Loading branch information
StefanVukovic99 committed Dec 27, 2023
commit 48aa429b8a0657699721d52e1ae15280f3751f26
4 changes: 2 additions & 2 deletions ext/data/templates/default-anki-field-templates.handlebars
Original file line number Diff line number Diff line change
Expand Up @@ -241,8 +241,8 @@
{{name}}
{{~set "any" true~}}
{{~/each~}}
{{~#if (get "any")}})</i> {{/if~}}
{{ipa}}
{{~#if (get "any")}})</i> {{/if~}}
{{ipa~}}
</li>
{{~/each~}}
{{~/each~}}
Expand Down
36 changes: 36 additions & 0 deletions test/data/anki-note-builder-test-results.json
Original file line number Diff line number Diff line change
Expand Up @@ -2796,6 +2796,42 @@
}
]
},
{
"name": "Test pronunciations 6 - phonetic transcriptions",
"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>(adj-na, n, Test Dictionary 2)</i> suki definition</div>",
"glossary-brief": "<div style=\"text-align: left;\">suki definition</div>",
"glossary-no-dictionary": "<div style=\"text-align: left;\"><i>(adj-na, n)</i> suki definition</div>",
"part-of-speech": "Unknown",
"pitch-accents": "No pitch accent data",
"pitch-accent-graphs": "No pitch accent data",
"pitch-accent-positions": "No pitch accent data",
"phonetic-transcriptions": "<ul><li><i>(東京)</i> [sɨᵝkʲi]</li></ul>",
"reading": "すき",
"screenshot": "",
"search-query": "fullQuery",
"selection-text": "",
"sentence": "cloze-prefix好きcloze-suffix",
"sentence-furigana": "cloze-prefix好きcloze-suffix",
"tags": "adj-na, n",
"url": "<a href=\"url:\">url:</a>"
}
]
},
{
"name": "Structured content test",
"results": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
["中腰", "ちゅうごし", "n", "n", 1, ["chuugoshi definition"], 11, ""],
["所業", "しょぎょう", "n", "n", 1, ["shogyouu definition"], 12, ""],
["土木工事", "どぼくこうじ", "n", "n", 1, ["dobokukouji definition"], 13, ""],
["好き", "すき", "adj-na n", "", 1, ["suki definition"], 14, ""],
[
"内容", "ないよう", "n", "n", 35,
[
Expand Down
10 changes: 10 additions & 0 deletions test/data/dictionaries/valid-dictionary1/term_meta_bank_1.json
Original file line number Diff line number Diff line change
Expand Up @@ -108,5 +108,15 @@
{"position": 4, "devoice": 3}
]
}
],
[
"好き",
"ipa",
{
"reading": "すき",
"transcriptions": [
{"ipa": "[sɨᵝkʲi]", "tags": ["東京"]}
]
}
]
]
7 changes: 7 additions & 0 deletions test/data/translator-test-inputs.json
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,13 @@
"text": "土木工事",
"options": "default"
},
{
"name": "Test pronunciations 6 - phonetic transcriptions",
"func": "findTerms",
"mode": "split",
"text": "好き",
"options": "default"
},
{
"name": "Structured content test",
"func": "findTerms",
Expand Down
210 changes: 209 additions & 1 deletion test/data/translator-test-results-note-data1.json
Original file line number Diff line number Diff line change
Expand Up @@ -28930,14 +28930,222 @@
}
]
},
{
"name": "Test pronunciations 6 - phonetic transcriptions",
"noteDataList": [
{
"marker": "{marker}",
"definition": {
"type": "term",
"id": 20,
"source": "好き",
"rawSource": "好き",
"sourceTerm": "好き",
"reasons": [],
"score": 1,
"isPrimary": true,
"sequence": 14,
"dictionary": "Test Dictionary 2",
"dictionaryOrder": {
"index": 0,
"priority": 0
},
"dictionaryNames": [
"Test Dictionary 2"
],
"expression": "好き",
"reading": "すき",
"expressions": [
{
"sourceTerm": "好き",
"expression": "好き",
"reading": "すき",
"termTags": [],
"frequencies": [],
"pitches": [
{
"index": 0,
"expressionIndex": 0,
"dictionary": "Test Dictionary 2",
"dictionaryOrder": {
"index": 0,
"priority": 0
},
"expression": "好き",
"reading": "すき",
"pitches": []
}
],
"furiganaSegments": [
{
"text": "好",
"furigana": "す"
},
{
"text": "き",
"furigana": ""
}
],
"termFrequency": "normal",
"wordClasses": []
}
],
"glossary": [
"suki definition"
],
"definitionTags": [
{
"name": "adj-na",
"category": "default",
"notes": "",
"order": 0,
"score": 0,
"dictionary": "Test Dictionary 2",
"redundant": false
},
{
"name": "n",
"category": "partOfSpeech",
"notes": "noun",
"order": 0,
"score": 0,
"dictionary": "Test Dictionary 2",
"redundant": false
}
],
"termTags": [],
"frequencies": [],
"pitches": [
{
"index": 0,
"expressionIndex": 0,
"dictionary": "Test Dictionary 2",
"dictionaryOrder": {
"index": 0,
"priority": 0
},
"expression": "好き",
"reading": "すき",
"pitches": []
}
],
"phoneticTranscriptions": [
{
"index": 0,
"expressionIndex": 0,
"dictionary": "Test Dictionary 2",
"dictionaryOrder": {
"index": 0,
"priority": 0
},
"expression": "好き",
"reading": "すき",
"phoneticTranscriptions": [
{
"ipa": "[sɨᵝkʲi]",
"tags": [
{
"name": "東京",
"category": "default",
"notes": "",
"order": 0,
"score": 0,
"dictionary": "Test Dictionary 2",
"redundant": false
}
]
}
]
}
],
"sourceTermExactMatchCount": 1,
"url": "url:",
"cloze": {
"sentence": "",
"prefix": "",
"body": "",
"suffix": ""
},
"furiganaSegments": [
{
"text": "好",
"furigana": "す"
},
{
"text": "き",
"furigana": ""
}
]
},
"glossaryLayoutMode": "default",
"compactTags": false,
"group": false,
"merge": false,
"modeTermKanji": false,
"modeTermKana": false,
"modeKanji": false,
"compactGlossaries": false,
"uniqueExpressions": [
"好き"
],
"uniqueReadings": [
"すき"
],
"pitches": [
{
"dictionary": "Test Dictionary 2",
"pitches": []
}
],
"pitchCount": 0,
"phoneticTranscriptions": [
{
"dictionary": "Test Dictionary 2",
"phoneticTranscriptions": [
{
"expressions": [
"好き"
],
"reading": "すき",
"ipa": "[sɨᵝkʲi]",
"tags": [
{
"name": "東京",
"category": "default",
"order": 0,
"score": 0,
"content": [],
"dictionaries": [
"Test Dictionary 2"
],
"redundant": false
}
],
"exclusiveExpressions": [],
"exclusiveReadings": []
}
]
}
],
"context": {
"query": "query",
"fullQuery": "fullQuery",
"document": {
"title": "title"
}
},
"media": {}
}
]
},
{
"name": "Structured content test",
"noteDataList": [
{
"marker": "{marker}",
"definition": {
"type": "term",
"id": 21,
"id": 22,
"source": "構造",
"rawSource": "構造",
"sourceTerm": "構造",
Expand Down
Loading
Loading