Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/english particle verbs to dev #314

Open
wants to merge 3 commits into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pattern/text/de/inflect.py
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,7 @@ def singularize(word, pos=NOUN, gender=MALE, role=SUBJECT, custom={}):
'zerren', 'zuenden', # zünden
'zuzeln', 'gellen', 'zuechten', # züchten
'ankern', 'angeln', 'herzigen', # 'be-herzigen after decomposition
'dauern', 'darben', 'danken', # for whatever reason 'da' appears in prefix_separable
'dauern', 'darben', 'danken', 'daten' # for whatever reason 'da' appears in prefix_separable
) # probably more

faux_latinate = (
Expand Down
35 changes: 35 additions & 0 deletions pattern/text/en/inflect.py
Original file line number Diff line number Diff line change
Expand Up @@ -655,10 +655,37 @@ def __init__(self):
29: 32, 30: 32, 31: 32, 32: 33 # past plural negated
})

def decompose_particle_verb(self, verb):
try:
if len(verb.split()) > 1:
verb, sattelites = verb.split(' ', 1)
else:
sattelites = ''
except Exception as e:
sattelites = ''

return verb, sattelites

def tenses(self, verb, parse=True):
if parse:
verb, _ = self.decompose_particle_verb(verb)
return _Verbs.tenses(self, verb, parse=parse)

def lemma(self, verb, parse=True):
if parse:
verb, sattelites = self.decompose_particle_verb(verb)
lemmatized = _Verbs.lemma(self, verb, parse=parse)
if sattelites:
return ' '.join([lemmatized, sattelites])
return lemmatized
else:
return _Verbs.lemma(self, verb, parse=parse)

def find_lemma(self, verb):
""" Returns the base form of the given inflected verb, using a rule-based approach.
This is problematic if a verb ending in -e is given in the past tense or gerund.
"""

v = verb.lower()
b = False
if v in ("'m", "'re", "'s", "n't"):
Expand Down Expand Up @@ -706,6 +733,14 @@ def find_lemma(self, verb):
return v + "e"
return v

def conjugate(self, verb, *args, **kwargs):
verb, sattelites = self.decompose_particle_verb(verb)
conjugated_verb = _Verbs.conjugate(self, verb, *args, **kwargs)
if sattelites:
return ' '.join([conjugated_verb, sattelites])
else:
return conjugated_verb

def find_lexeme(self, verb):
""" For a regular verb (base form), returns the forms using a rule-based approach.
"""
Expand Down