diff --git a/parsers/en_constants.py b/parsers/en_constants.py index aab251e2caa54dc289207e1a0540bd3e09fcea8d..76eca3e234cadaf30e83ceae3d84706d54bbc888 100644 --- a/parsers/en_constants.py +++ b/parsers/en_constants.py @@ -7,6 +7,8 @@ string_values = { "t_snd":"audio", #template for audio "t_acc":"a", #template for accents "t_deflabel":"lb", + "t_alt":"alternative spelling of", + "t_alt_param":1, #number of the parameter of t_alt containing the other spelling "t_ex":["ux", "usex"], "t_lbl":["lb","lbl", "label"], #template for labels "regions":{ diff --git a/parsers/en_en.py b/parsers/en_en.py index 80d0688ac4b286a8f0e7ac0eaa42ce13c195b5b4..a721c9b407e3d2f84ec11cd313b3189eff68ff3a 100644 --- a/parsers/en_en.py +++ b/parsers/en_en.py @@ -81,6 +81,8 @@ class En_en_straktor(Wikstraktor): def_text = parsed_def.plain_text().strip() templates = parsed_def.templates the_def = self.parse_template_1(templates) + if the_def == None: + the_def = self.parse_alt_spell(templates) if the_def == None: the_def = Definition(self.entry_language, def_text) if the_def == None: diff --git a/parsers/fr_constants.py b/parsers/fr_constants.py index b769bba6893ad9fc9506941ff7b2ef6e9141a6e7..66915f4ac35116074f6de724eadf7130311a0369 100644 --- a/parsers/fr_constants.py +++ b/parsers/fr_constants.py @@ -4,6 +4,8 @@ string_values = { "en":" {{langue|en}} ", "fr":"Français", "t_deflabel":["lexique", "info lex"], +"t_alt":"variante de", +"t_alt_param":0, #number of the parameter of t_alt containing the other spelling "t_ex":"exemple", #Inexistants "t_ipa":"pron", #template for transcription diff --git a/wikstraktor.py b/wikstraktor.py index 7c1803afdcf12618b7f61db8b74f7d0cdbd46296..f541cd435e3e3a6f67f68178e5d2ff697d951484 100755 --- a/wikstraktor.py +++ b/wikstraktor.py @@ -623,6 +623,14 @@ class Wikstraktor: def process_etymology(self, parsedwikitext): pass#in subclass + def parse_alt_spell(self, templates): + the_def = None + for t in templates: + if t.normal_name() == self.constants['t_alt']: + the_def = Definition(self.entry_language, f"Alternate spelling of “{t.arguments[self.constants['t_alt_param']].value}â€") + break + return the_def + #can be overloaded def process_example(self, example_wiki_text): k = 0 diff --git a/wikstraktor.sqlite b/wikstraktor.sqlite index 4bd4ff7ed7864b28501c509097276c377e190f0f..b60d5703a8684738f7a25ed782234ade2c97f3c3 100644 Binary files a/wikstraktor.sqlite and b/wikstraktor.sqlite differ