SekouD/mlconjug

KeyError: 'indicative' when trying to use in google colab

ernesto-butto opened this issue · 7 comments

Describe the bug
Hello, I tried using this lib on https://colab.research.google.com by testing the example code on documentation, but got KeyError: 'indicative'

To Reproduce
You can see the notebook in: https://drive.google.com/open?id=1_FSnfs0mtzjcUSddR8qY99ffZCaWm2Rq

OR try the code:

!pip install mlconjug
import mlconjug

default_conjugator = mlconjug.Conjugator(language='fr')

test1 = default_conjugator.conjugate("manger").conjug_info['indicative']['simple-past']['1p']
print(test1)

Got

KeyError: 'indicative' 

Expected behavior
Not sure, the documentation does not show the expected output. I'm guessing the verb conjugated properly

Desktop (please complete the following information):

  • Browser chrome
  • Version : latest

Hı @poolebu, thank you for using mlconjug and reporting this bug.

I made a change recently that converted the mood/tense names to the local language being conjugated.

It means that you should change your code to:
test1 = default_conjugator.conjugate("manger").conjug_info['Indicatif']['Passé Simple']['1p']

Thank you for sharing this issue. I am going to release a new version of mlconjug during the week that will allow to retrieve the conjugations using either english or native key names.

Cheers.

SekouD.

I will also update the documentation to reflect the changes made to the API

Thank you @SekouD . I find your work amazing, and looking forward to see what it can do. I'm working on a language learning app, and this feature would be incredible useful for people. I have received requests and this is the only library that I have found that it's working towards verbs conjugation using neural network models.

Users on the app are either native english or spanish, and want to learn spanish, english, french, italian. So this is perfect.

Updates on issue:

So, this is what is working for me for english at the moment in case someone is using the current version.

default_conjugator = mlconjug.Conjugator(language='en')

test1 = default_conjugator.conjugate("drink").conjug_info['imperative']['imperative present']['2p :']
print(test1) # prints drink

Note the : after the 2p .

However, if used with indicative:

test1 = default_conjugator.conjugate("drink").conjug_info['indicative']['indicative past tense']['1s']
print(test1) # Prints drank

To see available conjugations I used

test1 = default_conjugator.conjugate("drink").conjug_info
print(test1)

Prints

{'imperative': {'imperative present': OrderedDict([('2s :', 'drink'), ('1p :', 'drink'), ('2p :', 'drink')])}, 'indicative': {'indicative past tense': OrderedDict([('1s', 'drank'), ('2s', 'drank'), ('3s', 'drank'), ('1p', 'drank'), ('2p', 'drank'), ('3p', 'drank')]), 'indicative present': OrderedDict([('1s', 'drink'), ('2s', 'drink'), ('3s', 'drinks'), ('1p', 'drink'), ('2p', 'drink'), ('3p', 'drink')]), 'indicative present continuous': OrderedDict([('1s 1s', 'drinking'), ('2s 2s', 'drinking'), ('3s 3s', 'drinking'), ('1p 1p', 'drinking'), ('2p 2p', 'drinking'), ('3p 3p', 'drinking')]), 'indicative present perfect': OrderedDict([('1s', 'drunk'), ('2s', 'drunk'), ('3s', 'drunk'), ('1p', 'drunk'), ('2p', 'drunk'), ('3p', 'drunk')])}, 'infinitive': {'infinitive present': OrderedDict([('ink', 'drink')])}}

Hi @poolebu .

Your project looks very interesting, let me know its name and I will have a look at it.

Thanks for the detailed feedback with your issues.

I should have time to release a new version by Friday or Saturday.

I will let you know when I release it.

Cheers,

SekouD.

Hi @poolebu .

I just pushed a new version of mlconjug on master.
I will release version 3.3.2 tomorrow or on monday on PyPi

Thanks to your contribution, it fixes the bug when conjugating English regular verbs did not populate the conjugation properly.

I also changed the abbreviated personal pronouns to always be of the form '1s' instead of '1s :'.

Thank you very much for using mlconjug and reporting this issue.

I will be soon adding 3 to 4 new languages before the end of the month, and if you would like a particular language to be handled, do not hesitate to open an issue.

Cheers.

SekouD.

Hi @poolebu .

I just released the official v3.3.2 of mlconjug.
It fixes the bug when the English regular verbs where not populated properly as well as adding consistency in the use of abbreviated personal pronouns which are now all of the form '1s' instead of '1s :'.

Thank you again for your support and for using mlconjug.

Cheers,

SekouD.

Hello @SekouD , thank you very much for fixing this. I tested and is working perfectly now. I will let you know (not sure how to contact) when I have the project up, and also when I implement your library in our user interface so users can benefit. I will be working on it in the following weeks and I will no doubt report any issues I encounter.