Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

display_accentuation(get_accentuation('ἣ')) -- eta rough breathing and grave -- throws and error #17

Open
gregorycrane opened this issue Jun 11, 2020 · 5 comments

Comments

@gregorycrane
Copy link

display_accentuation(get_accentuation('ἣ'))
Traceback (most recent call last):
File "", line 1, in
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/greek_accentuation/accentuation.py", line 68, in display_accentuation
return accentuation.name.lower()
AttributeError: 'NoneType' object has no attribute 'name'

@gregorycrane
Copy link
Author

In this case, the function is brittle because it assumes we have checked for an accent rather than returning "none" or the like in the following case.

display_accentuation(get_accentuation('δ’'))
Traceback (most recent call last):
File "", line 1, in
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/greek_accentuation/accentuation.py", line 68, in display_accentuation
return accentuation.name.lower()
AttributeError: 'NoneType' object has no attribute 'name'

@jtauber
Copy link
Owner

jtauber commented Jun 12, 2020

I think the underlying issue here is that get_accentuation expects a normalized accentuation. It's not intended to handle graves or words with an additional oxytone because of a following enclitic.

(greek-normalisation handles that normalization step)

@gregorycrane
Copy link
Author

gregorycrane commented Jun 12, 2020 via email

@jtauber
Copy link
Owner

jtauber commented Jun 12, 2020

It's only ἣ in running text, though. The standalone form is ἥ and the assumption the code is making (which might be debatable but it's the assumption I made for my own work) is if you're querying for the accentuation type (e.g. is it perispomenon or paroxytone or whatever) that that's a property of the isolated accented word, not the string in running text.

In my own corpus work, I always use greek-normalisation and generate an isolated form for tokens. I talk about it a bit in this blog post: https://jktauber.com/2018/07/23/normalisation-column-morphgnt/

@jtauber
Copy link
Owner

jtauber commented Jun 12, 2020

If you don't want the full-on greek-normalisation you can also just copy paste the code from https://github.com/jtauber/greek-normalisation/blob/master/greek_normalisation/utils.py which has things like grave_to_acute and strip_last_accent_if_two as well as its own strip_accents too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants