Skip to content

Commit

Permalink
Merge pull request #394 from xxyzz/fr
Browse files Browse the repository at this point in the history
Fix two Python errors in French extractor
  • Loading branch information
xxyzz authored Nov 9, 2023
2 parents a3665b8 + a91e5a0 commit ec3044c
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/wiktextract/extractor/fr/inflection.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from collections import defaultdict, deque
from collections import defaultdict
from copy import deepcopy
from dataclasses import dataclass
from typing import Dict, List
Expand Down Expand Up @@ -58,7 +58,7 @@ def process_inflection_table(
return
table_node = table_nodes[0]
column_headers = []
rowspan_headers = deque()
rowspan_headers = []
colspan_headers = []
for row_num, table_row in enumerate(
table_node.find_child(NodeKind.TABLE_ROW)
Expand All @@ -83,14 +83,12 @@ def process_inflection_table(
for cell in table_row_nodes
)
row_headers = []
for index, (rowspan_text, rowspan_count) in enumerate(
rowspan_headers.copy()
):
new_rowspan_headers = []
for rowspan_text, rowspan_count in rowspan_headers:
row_headers.append(rowspan_text)
if rowspan_count - 1 == 0:
del rowspan_headers[index]
else:
rowspan_headers[index] = (rowspan_text, rowspan_count - 1)
if rowspan_count - 1 > 0:
new_rowspan_headers.append((rowspan_text, rowspan_count - 1))
rowspan_headers = new_rowspan_headers

column_cell_index = 0
for column_num, table_cell in enumerate(table_row_nodes):
Expand Down Expand Up @@ -174,4 +172,6 @@ def process_inflection_table(
new_form_data["form"] = form
page_data[-1]["forms"].append(new_form_data)

column_cell_index += int(table_cell.attrs.get("colspan", 1))
colspan_text = table_cell.attrs.get("colspan", "1")
if colspan_text.isdigit():
column_cell_index += int(colspan_text)

0 comments on commit ec3044c

Please sign in to comment.