diff --git a/CHANGES b/CHANGES index 624cd513..14dcc156 100644 --- a/CHANGES +++ b/CHANGES @@ -19,6 +19,10 @@ $ pipx install --suffix=@next unihan-etl --pip-args '\--pre' --force +### Bug fix + +- Expansions: Fix loading of double apostrophe values via `kRSUnicode` via `kRSGeneric` (#304) + ## unihan-etl 0.30.0post0 (2023-11-26) ### CI diff --git a/src/unihan_etl/expansion.py b/src/unihan_etl/expansion.py index d8435b6e..1d86eacc 100644 --- a/src/unihan_etl/expansion.py +++ b/src/unihan_etl/expansion.py @@ -573,11 +573,18 @@ class kRSGenericDict(t.TypedDict): def _expand_kRSGeneric(value: t.List[str]) -> t.List[kRSGenericDict]: - """Expand kRSGeneric field.""" + """Expand kRSGeneric field. + + Examples + -------- + >>> _expand_kRSGeneric(['5.10', "213''.0"]) # doctest: +NORMALIZE_WHITESPACE + [{'radical': 5, 'strokes': 10, 'simplified': False}, + {'radical': 213, 'strokes': 0, 'simplified': False}] + """ pattern = re.compile( r""" (?P[1-9][0-9]{0,2}) - (?P\'?)\. + (?P\'{0,2})\. (?P-?[0-9]{1,2}) """, re.X,