aboutsummaryrefslogtreecommitdiff
path: root/ext/data
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2021-10-14 21:26:53 -0400
committerGitHub <noreply@github.com>2021-10-14 21:26:53 -0400
commit75aabd983da29023b8423bd44d565202aad6b664 (patch)
tree754fbe5457747cd72fcf13767fc3176fc0d8f280 /ext/data
parent11f7591a7f5fcbfc3a3e631eaac0addb228c988a (diff)
String frequency support (#1989)
* Restore support for string frequency values * Add support for {value, displayValue} frequencies * Update test data * Improve number parsing of string frequencies * Improve reading detection * Expose a displayValue property for frequency information * Update docs * Expose displayValue to Anki note data * Fix translator * Update display generation * Update test data * Update counts
Diffstat (limited to 'ext/data')
-rw-r--r--ext/data/schemas/dictionary-kanji-meta-bank-v3-schema.json26
-rw-r--r--ext/data/schemas/dictionary-term-meta-bank-v3-schema.json28
2 files changed, 51 insertions, 3 deletions
diff --git a/ext/data/schemas/dictionary-kanji-meta-bank-v3-schema.json b/ext/data/schemas/dictionary-kanji-meta-bank-v3-schema.json
index 49f7c813..0864c9aa 100644
--- a/ext/data/schemas/dictionary-kanji-meta-bank-v3-schema.json
+++ b/ext/data/schemas/dictionary-kanji-meta-bank-v3-schema.json
@@ -1,5 +1,29 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
+ "definitions": {
+ "frequency": {
+ "oneOf": [
+ {
+ "type": ["string", "number"]
+ },
+ {
+ "type": "object",
+ "additionalProperties": false,
+ "required": [
+ "value"
+ ],
+ "properties": {
+ "value": {
+ "type": "number"
+ },
+ "displayValue": {
+ "type": "string"
+ }
+ }
+ }
+ ]
+ }
+ },
"type": "array",
"description": "Custom metadata for kanji characters.",
"additionalItems": {
@@ -17,7 +41,7 @@
"description": "Type of data. \"freq\" corresponds to frequency information."
},
{
- "type": ["number"],
+ "$ref": "#/definitions/frequency",
"description": "Data for the character."
}
]
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 206e7152..96f2e54b 100644
--- a/ext/data/schemas/dictionary-term-meta-bank-v3-schema.json
+++ b/ext/data/schemas/dictionary-term-meta-bank-v3-schema.json
@@ -1,5 +1,29 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
+ "definitions": {
+ "frequency": {
+ "oneOf": [
+ {
+ "type": ["string", "number"]
+ },
+ {
+ "type": "object",
+ "additionalProperties": false,
+ "required": [
+ "value"
+ ],
+ "properties": {
+ "value": {
+ "type": "number"
+ },
+ "displayValue": {
+ "type": "string"
+ }
+ }
+ }
+ ]
+ }
+ },
"type": "array",
"description": "Custom metadata for terms.",
"additionalItems": {
@@ -28,7 +52,7 @@
{
"oneOf": [
{
- "type": ["number"],
+ "$ref": "#/definitions/frequency",
"description": "Frequency information for the term."
},
{
@@ -44,7 +68,7 @@
"description": "Reading for the term."
},
"frequency": {
- "type": ["number"],
+ "$ref": "#/definitions/frequency",
"description": "Frequency information for the term."
}
}