bjascob / LemmInflect

A python module for English lemmatization and inflection.
MIT License
256 stars 25 forks source link

Converting between adverbs and adjectives #21

Open skarokin opened 3 months ago

skarokin commented 3 months ago

When using getAllInflections() on some adjective, the adverb forms given are the exact same as the adjective and vice versa. Is there a possible fix for this? I'm trying to generate the adjective form of adverbs and vice versa

bjascob commented 3 months ago

Please give specific examples of what the library gives and what you're expecting.

skarokin commented 3 months ago

Trying to generate the adverb form of an adjective gives the exact same results as trying to generate the different adjective forms. This is the same for adjective -> adverb

getAllInflections('quick', upos='ADV')
>>> {'RBR': ('quicker',), 'RBS': ('quickest',), 'RB': ('quick',)}
getAllInflections('quick', upos='ADJ')
>>> {'JJR': ('quicker',), 'JJS': ('quickest',), 'JJ': ('quick',)}

Is this intended?

bjascob commented 3 months ago

This is interesting but unfortunately I don't know the answer and there probably isn't a simple solution.

The NIH lexicon (which is where all the conversions come from) lists quick as both an ADV and an ADJ with reg variants (meaning they inflect with er and est). The word quickly is listed as a separate ADV but it is not associated with the word quick.

Doing check of the dictionary on Google, it looks like quick can be both an adjective or adverb in some instances so I'm not sure that it's even going to be possible to return a conversion from quick to quickly. Likely this is going to be limitation of the system.