Skip to content
Snippets Groups Projects
Commit 613ce653 authored by Enzo Simonnet's avatar Enzo Simonnet
Browse files

Def fonctionne

Pas encore exemples
parent 239fa610
No related branches found
No related tags found
No related merge requests found
......@@ -51,13 +51,22 @@ class En_en_straktor(Wikstraktor):
while i < len(l.fullitems):
newSense = Sense(f"{baseId}{i}")
li = self.wtp.parse(l.fullitems[i])
for t in li.templates:
if t.normal_name() == self.constants['t_deflabel']:
newSense.set_domain(t.arguments[1].value)#We could use the second parameter for a comment
newSense.add_def(self.wiki_language, li.plain_text().strip())
j=0
while j < len(li.templates) and li.templates[j].normal_name() != self.constants['t_deflabel']:
j += 1
if j < len(li.templates):
newSense.set_domain(li.templates[j].arguments[1].value)#We could use the second parameter for a comment
newSense.add_def(self.wiki_language, self.wtp.parse(li.get_lists()[0].items[0]).plain_text().strip())
senses.append(newSense)
if len(li.get_lists(pattern = '##')) > 0:
for j, k in enumerate(li.get_lists(pattern = '##')[0].items):
if self.wtp.parse(k).templates[0].normal_name() == self.constants['t_deflabel']:
newSense2 = Sense(f"{baseId}{i}{j}")
newSense2.set_domain(self.wtp.parse(k).templates[0].arguments[1].value)#We could use the second parameter for a comment
newSense2.add_def(self.wiki_language, self.wtp.parse(k).plain_text().strip())
senses.append(newSense2)
# TODO: process examples
i += 1
senses.append(newSense)
return senses
if __name__ == "__main__":
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment