Skip to content

Commit

Permalink
Change Chinese Wiktionary example data "type" value
Browse files Browse the repository at this point in the history
from "quote" to "quotation"
  • Loading branch information
xxyzz committed Oct 10, 2023
1 parent a7815f9 commit 1043094
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
8 changes: 6 additions & 2 deletions tests/test_zh_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,11 @@ def test_example_list(self) -> None:
self.assertEqual(
sense_data.get("examples"),
[
{"ref": "ref text", "text": "example text", "type": "quote"},
{
"ref": "ref text",
"text": "example text",
"type": "quotation",
},
],
)

Expand All @@ -57,7 +61,7 @@ def test_quote_example(self, mock_clean_node) -> None:
"ref": "ref text",
"text": "quote text",
"translation": "translation text",
"type": "quote",
"type": "quotation",
},
],
)
6 changes: 3 additions & 3 deletions wiktextract/extractor/zh/example.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def extract_example_list(
isinstance(child_node, WikiNode)
and child_node.kind == NodeKind.LIST
):
example_data["type"] = "quote"
example_data["type"] = "quotation"
example_data["ref"] = clean_node(wxr, None, node.children[:index])
example_data["text"] = clean_node(
wxr, None, child_node.children[0].children
Expand All @@ -69,7 +69,7 @@ def extract_quote_templates(
"""
Process template `quote-book` and "RQ:*".
"""
example_data["type"] = "quote"
example_data["type"] = "quotation"
expanded_text = clean_node(wxr, None, node)
for line_num, expanded_line in enumerate(expanded_text.splitlines()):
if line_num == 0:
Expand Down Expand Up @@ -128,7 +128,7 @@ def extract_template_zh_usex(
example_data["roman"] = expanded_line
elif expanded_line.startswith("來自:"):
example_data["ref"] = expanded_line[3:]
example_data["type"] = "quote"
example_data["type"] = "quotation"
else:
example_data["translation"] = expanded_line

Expand Down

0 comments on commit 1043094

Please sign in to comment.