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

Root missing when declining puer with Collatinus Decliner #1127

Open
mcorne opened this issue Sep 15, 2021 · 1 comment
Open

Root missing when declining puer with Collatinus Decliner #1127

mcorne opened this issue Sep 15, 2021 · 1 comment
Assignees
Labels

Comments

@mcorne
Copy link

mcorne commented Sep 15, 2021

The root is missing when declining puer, o etc. This is the case for the 5 models in https://github.com/cltk/lat_models_cltk/blob/master/lemmata/collatinus/src/modeles.la where the number of characters to remove from the canonical form is null: inv, puer, abraham, alter, miser.

Current behavior:
[('puer', '--s----n-'), ('puer', '--s----v-'), ('um', '--s----a-'), ('i', '--s----g-'), ('o', '--s----d-'), ('o', '--s----b-'), ('i', '--p----n-'), ('i', '--p----v-'), ('os', '--p----a-'), ('orum', '--p----g-'), ('is', '--p----d-'), ('is', '--p----b-')]

Steps to reproduce the behavior with https://github.com/cltk/lat_models_cltk/blob/master/lemmata/collatinus/collected.json:

from cltk.morphology.lat import CollatinusDecliner
decliner = CollatinusDecliner()
print(decliner.decline("puer"))

Expected behavior
[('puer', '--s----n-'), ('puer', '--s----v-'), ('puerum', '--s----a-'), ('pueri', '--s----g-'), ('puero', '--s----d-'), ('puero', '--s----b-'), ('pueri', '--p----n-'), ('pueri', '--p----v-'), ('pueros', '--p----a-'), ('puerorum', '--p----g-'), ('pueris', '--p----d-'), ('pueris', '--p----b-')]

Desktop:
Windows 10 with Python 3.9.7

@mcorne mcorne added the bug label Sep 15, 2021
@mcorne
Copy link
Author

mcorne commented Sep 15, 2021

Possible fix: in https://github.com/cltk/cltk/blob/master/src/cltk/morphology/lat.py line 122, replace:

returned_roots[model_root_id] = [
    lemma_root[:-deletion] + addition for lemma_root in lemma_roots
 ]

with:

if deletion:
    returned_root = [lemma_root[:-deletion] + addition for lemma_root in lemma_roots]
else:
    returned_root = [lemma_root + addition for lemma_root in lemma_roots]
returned_roots[model_root_id] = returned_root

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants