From 7955fc85ac089d856b44bdea78eccd26ffbd690c Mon Sep 17 00:00:00 2001 From: StefanVukovic99 Date: Mon, 3 Jun 2024 19:25:51 +0200 Subject: display inflection rule descriptions (#1000) * load descriptions in deinflector * description functions in deinflectors * show descriptions in title * use toaster * use names without internal * css lint * reformat transform descriptors * fix merge errors * done? * rename method --- types/ext/dictionary.d.ts | 7 ++++++- types/ext/language-transformer-internal.d.ts | 2 ++ types/ext/language-transformer.d.ts | 4 +++- types/ext/translation-internal.d.ts | 16 +++++++++++++++- types/ext/translator.d.ts | 5 ----- 5 files changed, 26 insertions(+), 8 deletions(-) (limited to 'types') diff --git a/types/ext/dictionary.d.ts b/types/ext/dictionary.d.ts index cc53ec0a..060e6907 100644 --- a/types/ext/dictionary.d.ts +++ b/types/ext/dictionary.d.ts @@ -258,7 +258,12 @@ export type InflectionRuleChainCandidate = { inflectionRules: InflectionRuleChain; }; -export type InflectionRuleChain = string[]; +export type InflectionRuleChain = InflectionRule[]; + +export type InflectionRule = { + name: string; + description?: string; +}; export type InflectionSource = 'algorithm' | 'dictionary' | 'both'; diff --git a/types/ext/language-transformer-internal.d.ts b/types/ext/language-transformer-internal.d.ts index a2b18b35..c3ea4b7c 100644 --- a/types/ext/language-transformer-internal.d.ts +++ b/types/ext/language-transformer-internal.d.ts @@ -16,9 +16,11 @@ */ export type Transform = { + id: string; name: string; rules: Rule[]; heuristic: RegExp; + description?: string; }; export type Rule = { diff --git a/types/ext/language-transformer.d.ts b/types/ext/language-transformer.d.ts index 02457523..cf5a0041 100644 --- a/types/ext/language-transformer.d.ts +++ b/types/ext/language-transformer.d.ts @@ -18,7 +18,9 @@ export type LanguageTransformDescriptor = { language: string; conditions: ConditionMapObject; - transforms: Transform[]; + transforms: { + [name: string]: Transform; + }; }; export type ConditionMapObject = { diff --git a/types/ext/translation-internal.d.ts b/types/ext/translation-internal.d.ts index 3360ac06..0efbe54f 100644 --- a/types/ext/translation-internal.d.ts +++ b/types/ext/translation-internal.d.ts @@ -40,15 +40,29 @@ export type TextDeinflectionOptionsArrays = [ emphatic: [collapseEmphatic: boolean, collapseEmphaticFull: boolean][], ]; +export type TermDictionaryEntry = Omit & { + inflectionRuleChainCandidates: InflectionRuleChainCandidate[]; +}; + +export type InflectionRuleChainCandidate = { + source: Dictionary.InflectionSource; + inflectionRules: string[]; +}; + export type DatabaseDeinflection = { originalText: string; transformedText: string; deinflectedText: string; conditions: number; - inflectionRuleChainCandidates: Dictionary.InflectionRuleChainCandidate[]; + inflectionRuleChainCandidates: InflectionRuleChainCandidate[]; databaseEntries: DictionaryDatabase.TermEntry[]; }; +export type DictionaryEntryGroup = { + ids: Set; + dictionaryEntries: TermDictionaryEntry[]; +}; + export type TextProcessorMap = Map< string, { diff --git a/types/ext/translator.d.ts b/types/ext/translator.d.ts index fb8d1142..0a4053cf 100644 --- a/types/ext/translator.d.ts +++ b/types/ext/translator.d.ts @@ -63,11 +63,6 @@ export type TagTargetItem = { targets: Dictionary.Tag[][]; }; -export type DictionaryEntryGroup = { - ids: Set; - dictionaryEntries: Dictionary.TermDictionaryEntry[]; -}; - export type SequenceQuery = { query: number; dictionary: string; -- cgit v1.2.3