Closed kwhumphreys closed 3 years ago
What is the use case where you're seeing this happen? My thinking is that if getAllInflectionsOOV
is called with a upos that isn't recognized, or is None, the user is doing something wrong and needs to be notified with a warning.
I was trying to suppress the warning in this case
>>> getInflection('test', 'RP')
Invalid upos type = None
so that I can call getInflection
for any tag, rather than pre-filtering.
I can add a pre-filter, but it wasn't necessary for pyinflect.
Asking the system to inflect a word into an "IN / Preposition or subordinating conjunction" seems like an error. The getAllInflections()
call is made to return all possible inflection types (no tag required) but for getInlfection()
you should only be asking the system to infect to valid types.
If you just want to suppress the warning message you can do...
import lemminflect
import logging
logging.getLogger('lemminflect.core.Inflections').setLevel(logging.ERROR)
This will change the logging level for just the Inflections class and won't impact anything else.
Understood. I can call tagToUpos
to check for valid inflection tags first.
But the warning is misleading because RP
to PART
is a valid upos, just not one that can be inflected.
for the expected case of OOV with unknown tag, when called from https://github.com/bjascob/LemmInflect/blob/master/lemminflect/core/Inflections.py#L124