From 3594527d8e851f05371d646f253ed00bdc802961 Mon Sep 17 00:00:00 2001 From: Forest Gregg Date: Fri, 25 Oct 2024 12:55:41 -0400 Subject: [PATCH] older style optional --- probablepeople/__init__.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/probablepeople/__init__.py b/probablepeople/__init__.py index f5acd4b..a961b8e 100644 --- a/probablepeople/__init__.py +++ b/probablepeople/__init__.py @@ -76,7 +76,7 @@ def _loadTagger(model_type: str) -> pycrfsuite.Tagger: TAGGER = _loadTagger("generic") -def parse(raw_string: str, type: str | None = None) -> list[tuple[str, str]]: +def parse(raw_string: str, type: typing.Optional[str] = None) -> list[tuple[str, str]]: if type is None: type = "generic" tagger = TAGGERS[type] @@ -99,7 +99,9 @@ def parse(raw_string: str, type: str | None = None) -> list[tuple[str, str]]: return list(zip(tokens, tags)) -def tag(raw_string: str, type: str | None = None) -> tuple[dict[str, str], str]: +def tag( + raw_string: str, type: typing.optional[str] = None +) -> tuple[dict[str, str], str]: tagged = {} prev_label = None