diff options
Diffstat (limited to 'types/ext')
-rw-r--r-- | types/ext/anki-templates.d.ts | 2 | ||||
-rw-r--r-- | types/ext/dictionary-data.d.ts | 9 | ||||
-rw-r--r-- | types/ext/dictionary.d.ts | 15 | ||||
-rw-r--r-- | types/ext/settings.d.ts | 1 | ||||
-rw-r--r-- | types/ext/translation-internal.d.ts | 5 | ||||
-rw-r--r-- | types/ext/translation.d.ts | 4 |
6 files changed, 30 insertions, 6 deletions
diff --git a/types/ext/anki-templates.d.ts b/types/ext/anki-templates.d.ts index 098873e6..7348b571 100644 --- a/types/ext/anki-templates.d.ts +++ b/types/ext/anki-templates.d.ts @@ -172,7 +172,7 @@ export type TermDictionaryEntry = { source: string | null; rawSource: string | null; sourceTerm?: string | null; - reasons: string[]; + inflectionRuleChainCandidates: Dictionary.InflectionRuleChainCandidate[]; score: number; isPrimary?: boolean; readonly sequence: number; diff --git a/types/ext/dictionary-data.d.ts b/types/ext/dictionary-data.d.ts index 0e0edd5c..82e0f00d 100644 --- a/types/ext/dictionary-data.d.ts +++ b/types/ext/dictionary-data.d.ts @@ -90,6 +90,11 @@ export type KanjiV3 = [ ]; export type TermGlossary = ( + TermGlossaryContent | + TermGlossaryDeinflection +); + +export type TermGlossaryContent = ( TermGlossaryString | TermGlossaryText | TermGlossaryImage | @@ -100,6 +105,10 @@ export type TermGlossaryString = string; export type TermGlossaryText = {type: 'text', text: string}; export type TermGlossaryImage = {type: 'image'} & TermImage; export type TermGlossaryStructuredContent = {type: 'structured-content', content: StructuredContent.Content}; +export type TermGlossaryDeinflection = [ + uninflected: string, + inflectionRuleChain: string[], +]; export type TermImage = StructuredContent.ImageElementBase & { // Compatibility properties diff --git a/types/ext/dictionary.d.ts b/types/ext/dictionary.d.ts index 7c348e7f..ed7769a9 100644 --- a/types/ext/dictionary.d.ts +++ b/types/ext/dictionary.d.ts @@ -208,9 +208,9 @@ export type TermDictionaryEntry = { */ isPrimary: boolean; /** - * A list of inflections that was applied to get the term. + * Ways that a looked-up word might be an inflected form of this term. */ - inflections: string[]; + inflectionRuleChainCandidates: InflectionRuleChainCandidate[]; /** * A score for the dictionary entry. */ @@ -253,6 +253,15 @@ export type TermDictionaryEntry = { frequencies: TermFrequency[]; }; +export type InflectionRuleChainCandidate = { + source: InflectionSource; + inflectionRules: InflectionRuleChain; +}; + +export type InflectionRuleChain = string[]; + +export type InflectionSource = 'algorithm' | 'dictionary' | 'both'; + /** * A term headword is a combination of a term, reading, and auxiliary information. */ @@ -337,7 +346,7 @@ export type TermDefinition = { /** * The definition entries. */ - entries: DictionaryData.TermGlossary[]; + entries: DictionaryData.TermGlossaryContent[]; }; /** diff --git a/types/ext/settings.d.ts b/types/ext/settings.d.ts index b95691b2..a3d3e141 100644 --- a/types/ext/settings.d.ts +++ b/types/ext/settings.d.ts @@ -259,6 +259,7 @@ export type DictionaryOptions = { allowSecondarySearches: boolean; definitionsCollapsible: DictionaryDefinitionsCollapsible; partsOfSpeechFilter: boolean; + useDeinflections: boolean; }; export type ParsingOptions = { diff --git a/types/ext/translation-internal.d.ts b/types/ext/translation-internal.d.ts index 5845b45d..15456e41 100644 --- a/types/ext/translation-internal.d.ts +++ b/types/ext/translation-internal.d.ts @@ -16,6 +16,7 @@ */ import type * as DictionaryDatabase from './dictionary-database'; +import type * as Dictionary from './dictionary'; import type * as Translation from './translation'; export type TextDeinflectionOptions = [ @@ -52,7 +53,7 @@ export enum DeinflectionRuleFlags { export type Deinflection = { term: string; rules: DeinflectionRuleFlags; - reasons: string[]; + reasons: Dictionary.InflectionRuleChain; }; export type DatabaseDeinflection = { @@ -60,6 +61,6 @@ export type DatabaseDeinflection = { transformedText: string; deinflectedText: string; rules: DeinflectionRuleFlags; - reasons: string[]; + inflectionRuleChainCandidates: Dictionary.InflectionRuleChainCandidate[]; databaseEntries: DictionaryDatabase.TermEntry[]; }; diff --git a/types/ext/translation.d.ts b/types/ext/translation.d.ts index d597c006..db0cf02f 100644 --- a/types/ext/translation.d.ts +++ b/types/ext/translation.d.ts @@ -177,6 +177,10 @@ export type FindTermDictionary = { * Whether this dictionary's part of speech rules should be used to filter results. */ partsOfSpeechFilter: boolean; + /** + * Whether to use the deinflections from this dictionary. + */ + useDeinflections: boolean; }; export type TermEnabledDictionaryMap = Map<string, FindTermDictionary>; |