Coverage for src/wiktextract/extractor/ru/etymology.py: 38%
12 statements
« prev ^ index » next coverage.py v7.6.10, created at 2024-12-27 08:07 +0000
« prev ^ index » next coverage.py v7.6.10, created at 2024-12-27 08:07 +0000
1from wikitextprocessor import WikiNode
2from wikitextprocessor.parser import LEVEL_KIND_FLAGS, TemplateNode
4from ...page import clean_node
5from ...wxr_context import WiktextractContext
6from .models import WordEntry
9def extract_etymology(
10 wxr: WiktextractContext,
11 word_entry: WordEntry,
12 level_node: WikiNode,
13) -> None:
14 etymology_nodes = []
15 for node in level_node.invert_find_child(LEVEL_KIND_FLAGS):
16 if isinstance(node, TemplateNode) and node.template_name == "improve":
17 # ignore this template
18 continue
19 etymology_nodes.append(node)
20 word_entry.etymology_text = clean_node(wxr, word_entry, etymology_nodes)