Skip to content

Commit

Permalink
Type senseid as str in Spanish extractor
Browse files Browse the repository at this point in the history
  • Loading branch information
empiriker committed Jan 5, 2024
1 parent b976575 commit 1f7b3f1
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
3 changes: 2 additions & 1 deletion src/wiktextract/extractor/es/gloss.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

from wikitextprocessor import NodeKind, WikiNode
from wikitextprocessor.parser import WikiNodeChildrenList

from wiktextract.extractor.es.models import Sense, WordEntry
from wiktextract.extractor.es.sense_data import process_sense_data_list
from wiktextract.page import clean_node
Expand Down Expand Up @@ -38,7 +39,7 @@ def extract_gloss(
match = re.match(r"^(\d+)", gloss_note)

if match:
gloss_data.senseid = int(match.group(1))
gloss_data.senseid = match.group(1)
tag_string = gloss_note[len(match.group(1)) :].strip()
else:
tag_string = gloss_note.strip()
Expand Down
2 changes: 1 addition & 1 deletion src/wiktextract/extractor/es/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ class Sense(BaseModelWrap):
# subsenses: list["Sense"] = Field(
# default=[], description="List of subsenses"
# )
senseid: Optional[int] = Field(
senseid: Optional[str] = Field(
default=None, description="Sense number used in Wiktionary"
)
antonyms: Optional[list[Linkage]] = []
Expand Down
6 changes: 3 additions & 3 deletions tests/test_es_gloss.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@ def test_es_extract_glosses(self):
"glosses": [
"Contribuir esfuerzo o recursos para la realización de algo."
],
"senseid": 1,
"senseid": "1",
},
{
"glosses": [
"Por antonomasia, cooperar a que alguno salga de una situación dificultosa"
],
"senseid": 2,
"senseid": "2",
},
],
)
Expand Down Expand Up @@ -80,7 +80,7 @@ def test_es_extract_gloss_categories(self):
"glosses": [
"Sentimiento afectivo de atracción, unión y afinidad que se experimenta hacia una persona, animal o cosa"
],
"senseid": 1,
"senseid": "1",
"tags": ["Humanidades"],
"categories": ["ES:Sentimientos"],
}
Expand Down

0 comments on commit 1f7b3f1

Please sign in to comment.