Skip to content

Commit

Permalink
improve coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
nobu-g committed Nov 2, 2023
1 parent 1e3e346 commit 8d1aa54
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
4 changes: 0 additions & 4 deletions src/rhoknp/processors/kwja.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@ def __init__(
self._output_format = "jumanpp"
elif "char" in tasks:
self._output_format = "words"
elif "senter" in tasks:
self._output_format = "line_by_line"
elif "typo" in tasks:
self._output_format = "raw"
else:
Expand Down Expand Up @@ -177,8 +175,6 @@ def _gen_input_text(self, document: Document) -> str:
def _create_document(self, text: str) -> Document:
if self._output_format == "raw":
return Document.from_raw_text(text)
elif self._output_format == "line_by_line":
return Document.from_line_by_line_text(text)
elif self._output_format == "jumanpp":
return Document.from_jumanpp(text)
elif self._output_format == "words":
Expand Down
6 changes: 4 additions & 2 deletions src/rhoknp/units/morpheme.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,9 +299,11 @@ def _from_jumanpp_line(cls, jumanpp_line: str, homograph: bool = False) -> "Morp
surf, reading, lemma = match["surf"], attributes[0], attributes[1]
semantics = SemanticsDict.from_sstring(match["sems"] or "")

# Resume text if it is escaped
# Resume text if it is escaped (Juman++ 2.0.0-rc3)
if semantics.get("元半角") is True:
surf, reading, lemma = (cls._UNESCAPE_MAP_HALF_TO_FULL_WIDTH.get(s, s) for s in (surf, reading, lemma))
surf, reading, lemma = (

Check warning on line 304 in src/rhoknp/units/morpheme.py

View check run for this annotation

Codecov / codecov/patch

src/rhoknp/units/morpheme.py#L304

Added line #L304 was not covered by tests
cls._UNESCAPE_MAP_HALF_TO_FULL_WIDTH.get(s, s) for s in (surf, reading, lemma)
) # pragma: no branch
surf, reading, lemma = (cls._UNESCAPE_MAP_CONTROL_CHAR.get(s, s) for s in (surf, reading, lemma))

return cls(
Expand Down

0 comments on commit 8d1aa54

Please sign in to comment.