Code Monkey home page Code Monkey logo

whitakers_words's People

Contributors

blagae avatar lukehollis avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

whitakers_words's Issues

Streamlit

Thanks for picking up Luke's great work here. I just wanted to reach out. I am currently designing a Streamlit app around your work. Would you like for me to keep you updated and post developments here? Would you be interested in a PR for this?

Gender of nouns is always 'Unknown'

Examples:

  • amator - amatrix
  • scriptor - scriptrix
  • sol - luna

Example response:

{
    "text": "scriptor",
    "forms": [
        {
            "text": "scriptor",
            "analyses": {
                "34453": {
                    "lexeme": {
                        "id": 34453,
                        "category": [
                            3,
                            1
                        ],
                        "roots": [
                            "scriptor",
                            "scriptor"
                        ],
                        "senses": [
                            "writer, author",
                            "scribe"
                        ],
                        "wordType": "Noun"
                    },
                    "root": "",
                    "inflections": [
                        {
                            "wordType": "Noun",
                            "category": [
                                3,
                                0
                            ],
                            "stem": "scriptor",
                            "affix": "",
                            "features": {
                                "Case": "Nominative",
                                "Number": "Singular",
                                "Gender": "Unknown"
                            },
                            "id": 279
                        },
                        {
                            "wordType": "Noun",
                            "category": [
                                3,
                                0
                            ],
                            "stem": "scriptor",
                            "affix": "",
                            "features": {
                                "Case": "Vocative",
                                "Number": "Singular",
                                "Gender": "Unknown"
                            },
                            "id": 280
                        }
                    ],
                    "enclitic": null
                },
                "34451": {
                    "lexeme": {
                        "id": 34451,
                        "category": [
                            1,
                            1
                        ],
                        "roots": [
                            "script",
                            "script",
                            "scriptav",
                            "scriptat"
                        ],
                        "senses": [
                            "write",
                            "compose"
                        ],
                        "wordType": "Verb"
                    },
                    "root": "",
                    "inflections": [
                        {
                            "wordType": "Verb",
                            "category": [
                                1,
                                1
                            ],
                            "stem": "script",
                            "affix": "or",
                            "features": {
                                "Tense": "Praesens",
                                "Voice": "Passive",
                                "Mood": "Indicative",
                                "Person": 1,
                                "Number": "Singular"
                            },
                            "id": 968
                        }
                    ],
                    "enclitic": null
                }
            },
            "enclitic": null
        }
    ]
}
  • Similar issue with adjectives, although that sometimes shows "Neuter" entries.

WordsFormatter can't handle any sum esse fui futurus verbs

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

More broken words

Steps to reproduce:

from whitakers_words.parse import Parser
parser = Parser()
parser.parse("deserto")

Output:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.7/site-packages/open_words/parse.py", line 71, in parse
    parse_result = self.analyze_forms(word)
  File "/usr/local/lib/python3.7/site-packages/open_words/parse.py", line 94, in analyze_forms
    match_stems = self.match_stems_inflections(form, viable_inflections)
  File "/usr/local/lib/python3.7/site-packages/open_words/parse.py", line 127, in match_stems_inflections
    if self.check_match(stem_cand, infl_cand):
  File "/usr/local/lib/python3.7/site-packages/open_words/parse.py", line 154, in check_match
    return stem['orth'] == wrd['parts'][-1]

Full list of words that were not able to get valid output from program

deserto
peccatorum
peccata
dicens
factum
de
descendentem
facta
desertum
credite
secus
piscatores
faciam
secuti
componentes
mirati
dicentes
nova
continuo
facto
desertis

parser.py doesn't handle "esse" verbs

Hi guys,

Thanks for writing this great library. I'm interested to lend a hand by helping to implement support for "esse" verbs in parser.py.

Right now these are being parsed as UniqueLexeme types. For example, parser.parse('sum').get_analyses()[0] will return the following:

{'lexeme': {'id': 0, 'category': [], 'roots': [], 'senses': ['to be, exist', 'also used to form verb perfect passive tenses with NOM PERF PPL'], 'wordType': <WordType.V: 'Verb'>}, 'root': '', 'inflections': [{'wordType': <WordType.V: 'Verb'>, 'stem': 'sum', 'affix': '', 'features': {'Tense': <Tense.PRES: 'Praesens'>, 'Voice': <Voice.ACTIVE: 'Active'>, 'Mood': <Mood.IND: 'Indicative'>, 'Person': <Person.1: 1>, 'Number': <Number.S: 'Singular'>}}], 'enclitic': None}

And type(parser.parse('sum').get_analyses()[0].lexeme) will return UniqueLexeme.

However I also notice there is an esse.py file in the data directory that isn't being referenced elsewhere. Was there a plan to implement this into parser.py?

Beatus generates IndexError: list index out of range

Hi,

Running whitaker from the command line after install from a git clone.

regemque works fine:

whitaker words regemque
que                  TACKON
-que = and (enclitic, translated before attached word); completes plerus/uter;
reg.em               N      3 1 ACC S M
rex, regis  N (3rd) M   [XLXAX]
king

beatus fails:

whitaker words beatus
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.10/bin/whitaker", line 33, in <module>
    sys.exit(load_entry_point('whitakers-words', 'console_scripts', 'whitaker')())
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/alt/whitakers-words/whitakers_words/whitakers_words/cli.py", line 46, in words
    fmt(result, WordsFormatter())
  File "/alt/whitakers-words/whitakers_words/whitakers_words/cli.py", line 50, in fmt
    click.echo(formatter.format_result(word))
  File "/alt/whitakers-words/whitakers_words/whitakers_words/formatter.py", line 76, in format_result
    result += f"{self.format_parts(analysis)}   [{props}]\n"
  File "/alt/whitakers-words/whitakers_words/whitakers_words/formatter.py", line 88, in format_parts
    return format_adj(analysis)
  File "/alt/whitakers-words/whitakers_words/whitakers_words/formatter.py", line 126, in format_adj
    comp_str = f"{root[2]}{comp[0]} -{comp[1]} -{comp[2]}"
IndexError: list index out of rang
```e


Many basic words are not being parsed properly

I happen to be a latinist, and was messing around with the python implementation here as I'm more familiar with python and have been building a few neat things with this, but noticing some pretty huge problems.

There are a lot of words that appear to not be getting parsed in the same way as the original application, worst of all being the pronouns and other incredibly common words like "deus", which gives no forms. ie. ipsum (as in dolorem ipsum), which should be the ACC of ipse (and some other forms), shows up as basically not existing. ea gives the forms NOM PL NEU, ACC PL NEU, but does not give ABL S F, NOM S F, etc. These are all words that have very high frequency in the latin language and as such, with them not being properly inflected, the library is pretty much unuseable.

If anybody has any ideas on what might be wrong and where, I'd be happy to try and understand the code and submit a PR if I can fix it, but would need a little direction. I found the part of the application where it loads INFLECTS (because this file has all the correct data), but its a bit arcane. May do some deep digging, but thought I would raise this.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.