From d0c3226dc84f071d2149021f2125cc0e44d015f8 Mon Sep 17 00:00:00 2001 From: Vilhjalmur Thorsteinsson Date: Thu, 19 Nov 2020 09:13:55 +0000 Subject: [PATCH] Blackening --- src/reynir/bintokenizer.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/reynir/bintokenizer.py b/src/reynir/bintokenizer.py index b1af2ee4..6ec5f50b 100644 --- a/src/reynir/bintokenizer.py +++ b/src/reynir/bintokenizer.py @@ -1322,7 +1322,9 @@ def eat_surnames( yield token -def parse_phrases_3(token_stream: Iterator[Bin_TOK], token_ctor: TokenConstructor) -> Iterator[Bin_TOK]: +def parse_phrases_3( + token_stream: Iterator[Bin_TOK], token_ctor: TokenConstructor +) -> Iterator[Bin_TOK]: """ Parse a stream of tokens looking for phrases and making substitutions. Third pass: coalesce uppercase, otherwise unrecognized words with a following person name, if any; also coalesce entity names and @@ -1638,7 +1640,9 @@ def match(self, tq: List[Tok], ix: int) -> Iterable[Tok]: yield self._token_ctor.Word(w, StaticPhrases.get_meaning(ix), token=tq) -def parse_static_phrases(token_stream: Iterator[Bin_TOK], token_ctor: TokenConstructor, auto_uppercase: bool) -> Iterator[Bin_TOK]: +def parse_static_phrases( + token_stream: Iterator[Bin_TOK], token_ctor: TokenConstructor, auto_uppercase: bool +) -> Iterator[Bin_TOK]: """ Use the StaticPhraseStream class to process the token stream and replace static phrases with single tokens """ sps = StaticPhraseStream(token_ctor, auto_uppercase) @@ -1721,7 +1725,9 @@ def match(self, tq: List[Tok], ix: int) -> Iterable[Tok]: yield token_ctor.Word(t.txt, mm, token=t) -def disambiguate_phrases(token_stream: Iterator[Bin_TOK], token_ctor: TokenConstructor) -> Iterator[Bin_TOK]: +def disambiguate_phrases( + token_stream: Iterator[Bin_TOK], token_ctor: TokenConstructor +) -> Iterator[Bin_TOK]: """ Parse a stream of tokens looking for common ambiguous multiword phrases (i.e. phrases that have a well known very likely interpretation but