You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have some code roughly like the following to automatically handle compound words not support explicitly.
nouns = Nouns()
result = nouns[word]
if len(result) == 0:
if "-" in word:
words = word.split("-")
word = words[-1]
words = "-".join(words[0:-1]) + "-"
lower = False
else:
words = nouns.parse_compound(word)
if len(words) < 2:
return []
word = words[-1]
words = "".join(words[0:-1])
lower = True
result = nouns[word]
if len(result) == 0:
return []
for i in range(len(result)):
lemma = result[i]["lemma"].lower() if lower else result[i]["lemma"]
result[i]["lemma"] = words + lemma
for flexion in result[i]["flexion"]:
flexion_expanded = (
result[i]["flexion"][flexion].lower()
if lower
else result[i]["flexion"][flexion]
)
result[i]["flexion"][flexion] = words + flexion_expanded
return result
Would you welcome a PR adding this natively? Potentially via some config variable.
The text was updated successfully, but these errors were encountered:
I have some code roughly like the following to automatically handle compound words not support explicitly.
Would you welcome a PR adding this natively? Potentially via some config variable.
The text was updated successfully, but these errors were encountered: