blagae / whitakers_words

Other
23 stars 5 forks source link

WordsFormatter can't handle any sum esse fui futurus verbs #7

Closed Big-coconut closed 10 months ago

Big-coconut commented 10 months ago

when i type any form of sum esse fui futurus the to this:

from whitakers_words.parser import Parser
from whitakers_words.formatter import WordsFormatter

parser = Parser()
formatter = WordsFormatter()

while True:
    words = input("=> ").split()
    result = ""
    for word in words:
        parsed = parser.parse(word)
        result += formatter.format_result(parsed)
        result += "\n\n"
    print(result)

it gives the error

Traceback (most recent call last):
  File "test.py", line 19, in <module>
    result += formatter.format_result(parsed)
  File "whitakers_words\formatter.py", line 69, in format_result
    result += " ".join(str(i) for i in inflection.category)
AttributeError: 'UniqueInflection' object has no attribute 'category'

it doesn't seem to effect other irregular verbs though

blagae commented 10 months ago

Thanks for your bug report.

First, some context: the WordsFormatter was added somewhat on a whim to more closely align with the goal of the original Whitaker's Words tool. It's a pretty naive implementation and still fraught with obvious bugs. The most common words are actually way more likely to be buggy, because I would seldom look them up in the command-line tool and thus not encounter the bugs myself.

I will look into this issue and (since I have the rare luxury of having some time this week) try to do some more improvements and fixes.

blagae commented 10 months ago

Hi @Big-coconut,

This issue was fixed, thanks for reporting it ! Because part of the problem was in the generated code, you will probably have to delete the generated folder from your install directory. It should redo the generating process on first use of the library.