Skip to content

Commit

Permalink
Merge pull request #897 from xxyzz/nl
Browse files Browse the repository at this point in the history
[nl] fix `AttributeError` in page "Waal"
  • Loading branch information
xxyzz authored Nov 4, 2024
2 parents d6bf104 + 6265fe1 commit f731f9e
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/wiktextract/extractor/nl/inflection.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def extract_noun_adj_table(
).splitlines():
if form_str not in ["", "-", wxr.wtp.title]:
form = Form(form=form_str)
if row_header not in ["", "naamwoord"]:
if row_header not in ["", "naamwoord", "demoniem"]:
form.raw_tags.append(row_header)
if col_index - 1 < len(column_headers):
form.raw_tags.append(
Expand Down Expand Up @@ -158,7 +158,7 @@ def extract_nlverb_template(
cell_rowspan_str = cell_node.attrs.get("rowspan", "1")
if re.fullmatch(r"\d+", cell_rowspan_str):
cell_rowspan = int(cell_rowspan_str)
cell_str = clean_node(wxr, None, cell_node)
cell_str = clean_node(wxr, None, cell_node).strip("| ")
if cell_str in ["", wxr.wtp.title]:
col_index += cell_colspan
is_row_first_node = False
Expand Down
2 changes: 2 additions & 0 deletions src/wiktextract/extractor/nl/page.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import re
from typing import Any

from mediawiki_langcodes import name_to_code
Expand Down Expand Up @@ -39,6 +40,7 @@ def parse_section(
# title templates
# https://nl.wiktionary.org/wiki/Categorie:Lemmasjablonen
title_text = clean_node(wxr, None, level_node.largs)
title_text = re.sub(r"\s+#?\d+:?$", "", title_text)
wxr.wtp.start_subsection(title_text)
etymology_data = []
if title_text in POS_DATA:
Expand Down
1 change: 1 addition & 0 deletions src/wiktextract/extractor/nl/section_titles.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
"Achtervoegsel": {"pos": "suffix", "tags": ["morpheme"]},
"Symbool": {"pos": "symbol"},
"Werkwoord": {"pos": "verb"},
"Betrekkelijk naamwoord": {"pos": "noun", "tags": ["relative"]},
}


Expand Down
2 changes: 1 addition & 1 deletion src/wiktextract/extractor/nl/tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ def translate_raw_tags(data: WordEntry) -> None:
data.tags.append(tr_tag)
elif isinstance(tr_tag, list):
data.tags.extend(tr_tag)
elif raw_tag in TOPICS:
elif raw_tag in TOPICS and hasattr(data, "topics"):
tr_topic = TOPICS[raw_tag]
if isinstance(tr_topic, str):
data.topics.append(tr_topic)
Expand Down

0 comments on commit f731f9e

Please sign in to comment.