aboutsummaryrefslogtreecommitdiff
path: root/ext/data
diff options
context:
space:
mode:
authorStefanVukovic99 <stefanvukovic44@gmail.com>2023-12-28 06:39:19 +0100
committerGitHub <noreply@github.com>2023-12-28 05:39:19 +0000
commitfc2123a45b3ceacc2ec887d24e5e752dca59bb4f (patch)
tree3a5105a6bff7a1755582c0cb9d38996933044b2b /ext/data
parent60cd218663f62f79394e9c0247e0fe40de6589b6 (diff)
add phonetic transcriptions term meta type (#434)
* move dictionary files to dictionary folder * wip * move dictionary files to dictionary folder * add ipa term meta * wip * fixing comments wip * fixing comments wip * fixing comments wip * fixing comments wip * fixing comments wip * fixing comments wip * fix comments * fix comments * update test data * fix gitignore * engines * add tests * update database test * fix test
Diffstat (limited to 'ext/data')
-rw-r--r--ext/data/schemas/dictionary-term-meta-bank-v3-schema.json52
-rw-r--r--ext/data/templates/default-anki-field-templates.handlebars21
2 files changed, 71 insertions, 2 deletions
diff --git a/ext/data/schemas/dictionary-term-meta-bank-v3-schema.json b/ext/data/schemas/dictionary-term-meta-bank-v3-schema.json
index 995c456a..1401b1eb 100644
--- a/ext/data/schemas/dictionary-term-meta-bank-v3-schema.json
+++ b/ext/data/schemas/dictionary-term-meta-bank-v3-schema.json
@@ -40,8 +40,8 @@
},
{
"type": "string",
- "enum": ["freq", "pitch"],
- "description": "Type of data. \"freq\" corresponds to frequency information; \"pitch\" corresponds to pitch information."
+ "enum": ["freq", "pitch", "ipa"],
+ "description": "Type of data. \"freq\" corresponds to frequency information; \"pitch\" corresponds to pitch information. \"ipa\" corresponds to IPA transcription."
},
{
"description": "Data for the term."
@@ -164,6 +164,54 @@
}
}
]
+ },
+ {
+ "minItems": 3,
+ "maxItems": 3,
+ "items": [
+ {},
+ {"const": "ipa"},
+ {
+ "type": ["object"],
+ "description": "IPA transcription information for the term.",
+ "required": [
+ "reading",
+ "transcriptions"
+ ],
+ "additionalProperties": false,
+ "properties": {
+ "reading": {
+ "type": "string",
+ "description": "Reading for the term."
+ },
+ "transcriptions": {
+ "type": "array",
+ "description": "List of different IPA transcription information for the term and reading combination.",
+ "items": {
+ "type": "object",
+ "required": [
+ "ipa"
+ ],
+ "additionalProperties": false,
+ "properties": {
+ "ipa": {
+ "type": "string",
+ "description": "IPA transcription for the term."
+ },
+ "tags": {
+ "type": "array",
+ "description": "List of tags for this IPA transcription.",
+ "items": {
+ "type": "string",
+ "description": "Tag for this IPA transcription."
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ ]
}
]
}
diff --git a/ext/data/templates/default-anki-field-templates.handlebars b/ext/data/templates/default-anki-field-templates.handlebars
index d94f6d70..f23b9d0b 100644
--- a/ext/data/templates/default-anki-field-templates.handlebars
+++ b/ext/data/templates/default-anki-field-templates.handlebars
@@ -229,6 +229,27 @@
{{/inline}}
{{! End Pitch Accents }}
+{{#*inline "phonetic-transcriptions"}}
+ {{~#if (op ">" definition.phoneticTranscriptions.length 0)~}}
+ <ul>
+ {{~#each definition.phoneticTranscriptions~}}
+ {{~#each phoneticTranscriptions~}}
+ <li>
+ {{~set "any" false~}}
+ {{~#each tags~}}
+ {{~#if (get "any")}}, {{else}}<i>({{/if~}}
+ {{name}}
+ {{~set "any" true~}}
+ {{~/each~}}
+ {{~#if (get "any")}})</i> {{/if~}}
+ {{ipa~}}
+ </li>
+ {{~/each~}}
+ {{~/each~}}
+ </ul>
+ {{~/if~}}
+{{/inline}}
+
{{#*inline "clipboard-image"}}
{{~#if (hasMedia "clipboardImage")~}}
<img src="{{getMedia "clipboardImage"}}" />