Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
aajanki committed Aug 21, 2021
1 parent 0b6180a commit 43e89d9
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
2 changes: 2 additions & 0 deletions fi/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
from .fi import FinnishExtended, MorphologizerLemmatizer

__all__ = ['FinnishExtended', 'MorphologizerLemmatizer']
23 changes: 11 additions & 12 deletions fi/fi.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class MorphologizerLemmatizer(Pipe):
"vajanto": "Case=Abe",
"seuranto": "Case=Com",
"keinonto": "Case=Ins",
"kerrontosti": "Case=Nom" # Should never occur. "kerrontosti"
"kerrontosti": "Case=Nom" # Should not occur. "kerrontosti"
# should only appear on ADVs, which
# don't have cases.
}
Expand All @@ -64,9 +64,9 @@ class MorphologizerLemmatizer(Pipe):
PRON: frozenset(["asemosana", "nimisana", "nimisana_laatusana"]),
PROPN: frozenset(["nimi", "etunimi", "sukunimi", "paikannimi"]),
SCONJ: frozenset(["sidesana"]),
VERB: frozenset([]), # Would be "teonsana" but
# MINEN-infinitives are treated as noun.
# See _analysis_has_compatible_pos()
VERB: frozenset([]), # Would be "teonsana" except that
# MINEN-infinitives are treated as nouns.
# See _analysis_has_compatible_pos()
SYM: frozenset([]),
X: frozenset([])
}
Expand Down Expand Up @@ -355,7 +355,7 @@ def voikko_morph(self, token: Token, analysis: dict) -> Optional[str]:
# Clitic
if morph_clitic is not None:
morphology.append(morph_clitic)

# Connegative
if "CONNEGATIVE" in analysis:
morphology.append("Connegative=Yes")
Expand Down Expand Up @@ -463,7 +463,7 @@ def voikko_morph(self, token: Token, analysis: dict) -> Optional[str]:
# Degree
if "COMPARISON" in analysis:
morphology.append(self.voikko_degree[analysis["COMPARISON"]])

# Number
if morph_number is not None:
morphology.append(morph_number)
Expand Down Expand Up @@ -507,7 +507,7 @@ def voikko_morph(self, token: Token, analysis: dict) -> Optional[str]:
# Clitic
if morph_clitic is not None:
morphology.append(morph_clitic)

# Number
if morph_number is not None:
morphology.append(morph_number)
Expand Down Expand Up @@ -537,7 +537,7 @@ def voikko_morph(self, token: Token, analysis: dict) -> Optional[str]:
# Case
if "SIJAMUOTO" in analysis:
morphology.append(self.voikko_cases[analysis["SIJAMUOTO"]])

elif token.tag == self.foreign_tag:
# Foreign
morphology.append('Foreign=Yes')
Expand Down Expand Up @@ -568,7 +568,7 @@ def lemmatize(self, token: Token, analysis: dict) -> str:
return self._adv_lemma(analysis, cached_lower)
elif token.pos == ADP:
return cached_lower or token.orth_.lower()
elif not "BASEFORM" in analysis:
elif "BASEFORM" not in analysis:
if token.pos in (PROPN, INTJ, SYM, X):
return token.orth_
else:
Expand Down Expand Up @@ -704,7 +704,7 @@ def _enrich_voikko_analysis(self, token, analysis):
if token.pos in (NOUN, NUM, PROPN) and "SIJAMUOTO" not in analysis:
i = token.orth_.find(":")
if i > 0:
affix = token.orth_[(i+1):]
affix = token.orth_[(i + 1):]
sijamuoto = self.affix_to_sijamuoto.get(affix)
if sijamuoto:
analysis["SIJAMUOTO"] = sijamuoto
Expand Down Expand Up @@ -775,7 +775,7 @@ def _disambiguate_analyses(self, token, analyses):
analyses = [x for x in analyses if "j" in x.get("STRUCTURE")]

elif token.pos in (NOUN, PRON) and \
((token.dep in self.nsubj_labels) or \
((token.dep in self.nsubj_labels) or
(token.dep == conj and token.head.dep in self.nsubj_labels)):
# Subject is usually nominative, genetive or partitive
analyses = [
Expand Down Expand Up @@ -1074,7 +1074,6 @@ def __call__(self, nlp: "Language") -> Iterator[Example]:
if self.limit >= 1 and i >= self.limit:
return


def vrt_extract_documents(self, fileobj):
tokens = []
quote_active = False
Expand Down
1 change: 0 additions & 1 deletion tools/create_lexdata.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import math
import sys
import typer
from itertools import islice
from pathlib import Path


Expand Down
4 changes: 2 additions & 2 deletions tools/preprocess_finer.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

def main():
keep_tags = ['B-ORG', 'I-ORG', 'B-LOC', 'I-LOC', 'B-PER', 'I-PER', 'O']

sentence_boundary = True
for line in sys.stdin:
if line == '\n' or line == '\t\t\n':
Expand All @@ -18,7 +18,7 @@ def main():
cols = line.split('\t')
tag = cols[1] if cols[1] in keep_tags else 'O'
outcols = [cols[0], tag]

sys.stdout.write('\t'.join(outcols))
sys.stdout.write('\n')

Expand Down

0 comments on commit 43e89d9

Please sign in to comment.