mirror of
https://github.com/explosion/spaCy.git
synced 2024-12-24 17:06:29 +03:00
Added ancient Greek language support (#8606)
* Add ancient Greek language support Initial commit * Contributor Agreement * grc tokenizer test added and files formatted with black, unnecessary import removed Co-Authored-By: Sofie Van Landeghem <svlandeg@users.noreply.github.com> * Commas in lists fixed. __init__py added to test * Update lex_attrs.py * Update stop_words.py * Update stop_words.py Co-authored-by: Sofie Van Landeghem <svlandeg@users.noreply.github.com>
This commit is contained in:
parent
77859beb99
commit
993b0fab0e
106
.github/contributors/jmyerston.md
vendored
Normal file
106
.github/contributors/jmyerston.md
vendored
Normal file
|
@ -0,0 +1,106 @@
|
|||
# spaCy contributor agreement
|
||||
|
||||
This spaCy Contributor Agreement (**"SCA"**) is based on the
|
||||
[Oracle Contributor Agreement](http://www.oracle.com/technetwork/oca-405177.pdf).
|
||||
The SCA applies to any contribution that you make to any product or project
|
||||
managed by us (the **"project"**), and sets out the intellectual property rights
|
||||
you grant to us in the contributed materials. The term **"us"** shall mean
|
||||
[ExplosionAI GmbH](https://explosion.ai/legal). The term
|
||||
**"you"** shall mean the person or entity identified below.
|
||||
|
||||
If you agree to be bound by these terms, fill in the information requested
|
||||
below and include the filled-in version with your first pull request, under the
|
||||
folder [`.github/contributors/`](/.github/contributors/). The name of the file
|
||||
should be your GitHub username, with the extension `.md`. For example, the user
|
||||
example_user would create the file `.github/contributors/example_user.md`.
|
||||
|
||||
Read this agreement carefully before signing. These terms and conditions
|
||||
constitute a binding legal agreement.
|
||||
|
||||
## Contributor Agreement
|
||||
|
||||
1. The term "contribution" or "contributed materials" means any source code,
|
||||
object code, patch, tool, sample, graphic, specification, manual,
|
||||
documentation, or any other material posted or submitted by you to the project.
|
||||
|
||||
2. With respect to any worldwide copyrights, or copyright applications and
|
||||
registrations, in your contribution:
|
||||
|
||||
* you hereby assign to us joint ownership, and to the extent that such
|
||||
assignment is or becomes invalid, ineffective or unenforceable, you hereby
|
||||
grant to us a perpetual, irrevocable, non-exclusive, worldwide, no-charge,
|
||||
royalty-free, unrestricted license to exercise all rights under those
|
||||
copyrights. This includes, at our option, the right to sublicense these same
|
||||
rights to third parties through multiple levels of sublicensees or other
|
||||
licensing arrangements;
|
||||
|
||||
* you agree that each of us can do all things in relation to your
|
||||
contribution as if each of us were the sole owners, and if one of us makes
|
||||
a derivative work of your contribution, the one who makes the derivative
|
||||
work (or has it made will be the sole owner of that derivative work;
|
||||
|
||||
* you agree that you will not assert any moral rights in your contribution
|
||||
against us, our licensees or transferees;
|
||||
|
||||
* you agree that we may register a copyright in your contribution and
|
||||
exercise all ownership rights associated with it; and
|
||||
|
||||
* you agree that neither of us has any duty to consult with, obtain the
|
||||
consent of, pay or render an accounting to the other for any use or
|
||||
distribution of your contribution.
|
||||
|
||||
3. With respect to any patents you own, or that you can license without payment
|
||||
to any third party, you hereby grant to us a perpetual, irrevocable,
|
||||
non-exclusive, worldwide, no-charge, royalty-free license to:
|
||||
|
||||
* make, have made, use, sell, offer to sell, import, and otherwise transfer
|
||||
your contribution in whole or in part, alone or in combination with or
|
||||
included in any product, work or materials arising out of the project to
|
||||
which your contribution was submitted, and
|
||||
|
||||
* at our option, to sublicense these same rights to third parties through
|
||||
multiple levels of sublicensees or other licensing arrangements.
|
||||
|
||||
4. Except as set out above, you keep all right, title, and interest in your
|
||||
contribution. The rights that you grant to us under these terms are effective
|
||||
on the date you first submitted a contribution to us, even if your submission
|
||||
took place before the date you sign these terms.
|
||||
|
||||
5. You covenant, represent, warrant and agree that:
|
||||
|
||||
* Each contribution that you submit is and shall be an original work of
|
||||
authorship and you can legally grant the rights set out in this SCA;
|
||||
|
||||
* to the best of your knowledge, each contribution will not violate any
|
||||
third party's copyrights, trademarks, patents, or other intellectual
|
||||
property rights; and
|
||||
|
||||
* each contribution shall be in compliance with U.S. export control laws and
|
||||
other applicable export and import laws. You agree to notify us if you
|
||||
become aware of any circumstance which would make any of the foregoing
|
||||
representations inaccurate in any respect. We may publicly disclose your
|
||||
participation in the project, including the fact that you have signed the SCA.
|
||||
|
||||
6. This SCA is governed by the laws of the State of California and applicable
|
||||
U.S. Federal law. Any choice of law rules will not apply.
|
||||
|
||||
7. Please place an “x” on one of the applicable statement below. Please do NOT
|
||||
mark both statements:
|
||||
|
||||
* [x] I am signing on behalf of myself as an individual and no other person
|
||||
or entity, including my employer, has or will have rights with respect to my
|
||||
contributions.
|
||||
|
||||
* [ ] I am signing on behalf of my employer or a legal entity and I have the
|
||||
actual authority to contractually bind that entity.
|
||||
|
||||
## Contributor Details
|
||||
|
||||
| Field | Entry |
|
||||
| ----------------------------- | ----------------------------------- |
|
||||
| Name | Jacobo Myerston |
|
||||
| Company name (if applicable) | University of California, San Diego |
|
||||
| Title or role (if applicable) | Academic |
|
||||
| Date | 07/05/2021 |
|
||||
| GitHub username | jmyerston |
|
||||
| Website (optional) | diogenet.ucsd.edu |
|
18
spacy/lang/grc/__init__.py
Normal file
18
spacy/lang/grc/__init__.py
Normal file
|
@ -0,0 +1,18 @@
|
|||
from .tokenizer_exceptions import TOKENIZER_EXCEPTIONS
|
||||
from .stop_words import STOP_WORDS
|
||||
from .lex_attrs import LEX_ATTRS
|
||||
from ...language import Language
|
||||
|
||||
|
||||
class AncientGreekDefaults(Language.Defaults):
|
||||
tokenizer_exceptions = TOKENIZER_EXCEPTIONS
|
||||
lex_attr_getters = LEX_ATTRS
|
||||
stop_words = STOP_WORDS
|
||||
|
||||
|
||||
class AncientGreek(Language):
|
||||
lang = "grc"
|
||||
Defaults = AncientGreekDefaults
|
||||
|
||||
|
||||
__all__ = ["AncientGreek"]
|
17
spacy/lang/grc/examples.py
Normal file
17
spacy/lang/grc/examples.py
Normal file
|
@ -0,0 +1,17 @@
|
|||
"""
|
||||
Example sentences to test spaCy and its language models.
|
||||
|
||||
>>> from spacy.lang.grc.examples import sentences
|
||||
>>> docs = nlp.pipe(sentences)
|
||||
"""
|
||||
|
||||
|
||||
sentences = [
|
||||
"ἐρᾷ μὲν ἁγνὸς οὐρανὸς τρῶσαι χθόνα, ἔρως δὲ γαῖαν λαμβάνει γάμου τυχεῖν·",
|
||||
"εὐδαίμων Χαρίτων καὶ Μελάνιππος ἔφυ, θείας ἁγητῆρες ἐφαμερίοις φιλότατος.",
|
||||
"ὃ μὲν δὴ ἀπόστολος ἐς τὴν Μίλητον ἦν.",
|
||||
"Θρασύβουλος δὲ σαφέως προπεπυσμένος πάντα λόγον καὶ εἰδὼς τὰ Ἀλυάττης μέλλοι ποιήσειν μηχανᾶται τοιάδε.",
|
||||
"φιλόπαις δ' ἦν ἐκμανῶς καὶ Ἀλέξανδρος ὁ βασιλεύς.",
|
||||
"Ἀντίγονος ὁ βασιλεὺς ἐπεκώμαζε τῷ Ζήνωνι",
|
||||
"αὐτὰρ ὃ δεύτατος ἦλθεν ἄναξ ἀνδρῶν Ἀγαμέμνων ἕλκος ἔχων",
|
||||
]
|
314
spacy/lang/grc/lex_attrs.py
Normal file
314
spacy/lang/grc/lex_attrs.py
Normal file
|
@ -0,0 +1,314 @@
|
|||
from ...attrs import LIKE_NUM
|
||||
|
||||
|
||||
_num_words = [
|
||||
# CARDINALS
|
||||
"εἷς",
|
||||
"ἑνός",
|
||||
"ἑνί",
|
||||
"ἕνα",
|
||||
"μία",
|
||||
"μιᾶς",
|
||||
"μιᾷ",
|
||||
"μίαν",
|
||||
"ἕν",
|
||||
"δύο",
|
||||
"δυοῖν",
|
||||
"τρεῖς",
|
||||
"τριῶν",
|
||||
"τρισί",
|
||||
"τρία",
|
||||
"τέτταρες",
|
||||
"τεττάρων",
|
||||
"τέτταρσι",
|
||||
"τέτταρα",
|
||||
"τέτταρας",
|
||||
"πέντε",
|
||||
"ἕξ",
|
||||
"ἑπτά",
|
||||
"ὀκτώ",
|
||||
"ἐννέα",
|
||||
"δέκα",
|
||||
"ἕνδεκα",
|
||||
"δώδεκα",
|
||||
"πεντεκαίδεκα",
|
||||
"ἑκκαίδεκα",
|
||||
"ἑπτακαίδεκα",
|
||||
"ὀκτωκαίδεκα",
|
||||
"ἐννεακαίδεκα",
|
||||
"εἴκοσι",
|
||||
"τριάκοντα",
|
||||
"τετταράκοντα",
|
||||
"πεντήκοντα",
|
||||
"ἑξήκοντα",
|
||||
"ἑβδομήκοντα",
|
||||
"ὀγδοήκοντα",
|
||||
"ἐνενήκοντα",
|
||||
"ἑκατόν",
|
||||
"διακόσιοι",
|
||||
"διακοσίων",
|
||||
"διακοσιᾶν",
|
||||
"διακοσίους",
|
||||
"διακοσίοις",
|
||||
"διακόσια",
|
||||
"διακόσιαι",
|
||||
"διακοσίαις",
|
||||
"διακοσίαισι",
|
||||
"διηκόσιοι",
|
||||
"διηκοσίων",
|
||||
"διηκοσιέων",
|
||||
"διακοσίας",
|
||||
"διηκόσια",
|
||||
"διηκόσιαι",
|
||||
"διηκοσίας",
|
||||
"τριακόσιοι",
|
||||
"τριακοσίων",
|
||||
"τριακοσιᾶν",
|
||||
"τριακοσίους",
|
||||
"τριακοσίοις",
|
||||
"τριακόσια",
|
||||
"τριακόσιαι",
|
||||
"τριακοσίαις",
|
||||
"τριακοσίαισι",
|
||||
"τριακοσιέων",
|
||||
"τριακοσίας",
|
||||
"τριηκόσια",
|
||||
"τριηκοσίας",
|
||||
"τριηκόσιοι",
|
||||
"τριηκοσίοισιν",
|
||||
"τριηκοσίους",
|
||||
"τριηκοσίων",
|
||||
"τετρακόσιοι",
|
||||
"τετρακοσίων",
|
||||
"τετρακοσιᾶν",
|
||||
"τετρακοσίους",
|
||||
"τετρακοσίοις",
|
||||
"τετρακόσια",
|
||||
"τετρακόσιαι",
|
||||
"τετρακοσίαις",
|
||||
"τετρακοσίαισι",
|
||||
"τετρακοσιέων",
|
||||
"τετρακοσίας",
|
||||
"πεντακόσιοι",
|
||||
"πεντακοσίων",
|
||||
"πεντακοσιᾶν",
|
||||
"πεντακοσίους",
|
||||
"πεντακοσίοις",
|
||||
"πεντακόσια",
|
||||
"πεντακόσιαι",
|
||||
"πεντακοσίαις",
|
||||
"πεντακοσίαισι",
|
||||
"πεντακοσιέων",
|
||||
"πεντακοσίας",
|
||||
"ἑξακόσιοι",
|
||||
"ἑξακοσίων",
|
||||
"ἑξακοσιᾶν",
|
||||
"ἑξακοσίους",
|
||||
"ἑξακοσίοις",
|
||||
"ἑξακόσια",
|
||||
"ἑξακόσιαι",
|
||||
"ἑξακοσίαις",
|
||||
"ἑξακοσίαισι",
|
||||
"ἑξακοσιέων",
|
||||
"ἑξακοσίας",
|
||||
"ἑπτακόσιοι",
|
||||
"ἑπτακοσίων",
|
||||
"ἑπτακοσιᾶν",
|
||||
"ἑπτακοσίους",
|
||||
"ἑπτακοσίοις",
|
||||
"ἑπτακόσια",
|
||||
"ἑπτακόσιαι",
|
||||
"ἑπτακοσίαις",
|
||||
"ἑπτακοσίαισι",
|
||||
"ἑπτακοσιέων",
|
||||
"ἑπτακοσίας",
|
||||
"ὀκτακόσιοι",
|
||||
"ὀκτακοσίων",
|
||||
"ὀκτακοσιᾶν",
|
||||
"ὀκτακοσίους",
|
||||
"ὀκτακοσίοις",
|
||||
"ὀκτακόσια",
|
||||
"ὀκτακόσιαι",
|
||||
"ὀκτακοσίαις",
|
||||
"ὀκτακοσίαισι",
|
||||
"ὀκτακοσιέων",
|
||||
"ὀκτακοσίας",
|
||||
"ἐνακόσιοι",
|
||||
"ἐνακοσίων",
|
||||
"ἐνακοσιᾶν",
|
||||
"ἐνακοσίους",
|
||||
"ἐνακοσίοις",
|
||||
"ἐνακόσια",
|
||||
"ἐνακόσιαι",
|
||||
"ἐνακοσίαις",
|
||||
"ἐνακοσίαισι",
|
||||
"ἐνακοσιέων",
|
||||
"ἐνακοσίας",
|
||||
"χίλιοι",
|
||||
"χιλίων",
|
||||
"χιλιῶν",
|
||||
"χιλίους",
|
||||
"χιλίοις",
|
||||
"χίλιαι",
|
||||
"χιλίας",
|
||||
"χιλίαις",
|
||||
"χίλια",
|
||||
"χίλι",
|
||||
"δισχίλιοι",
|
||||
"δισχιλίων",
|
||||
"δισχιλιῶν",
|
||||
"δισχιλίους",
|
||||
"δισχιλίοις",
|
||||
"δισχίλιαι",
|
||||
"δισχιλίας",
|
||||
"δισχιλίαις",
|
||||
"δισχίλια",
|
||||
"δισχίλι",
|
||||
"τρισχίλιοι",
|
||||
"τρισχιλίων",
|
||||
"τρισχιλιῶν",
|
||||
"τρισχιλίους",
|
||||
"τρισχιλίοις",
|
||||
"τρισχίλιαι",
|
||||
"τρισχιλίας",
|
||||
"τρισχιλίαις",
|
||||
"τρισχίλια",
|
||||
"τρισχίλι",
|
||||
"μύριοι",
|
||||
"μύριοί",
|
||||
"μυρίων",
|
||||
"μυρίοις",
|
||||
"μυρίους",
|
||||
"μύριαι",
|
||||
"μυρίαις",
|
||||
"μυρίας",
|
||||
"μύρια",
|
||||
"δισμύριοι",
|
||||
"δισμύριοί",
|
||||
"δισμυρίων",
|
||||
"δισμυρίοις",
|
||||
"δισμυρίους",
|
||||
"δισμύριαι",
|
||||
"δισμυρίαις",
|
||||
"δισμυρίας",
|
||||
"δισμύρια",
|
||||
"δεκακισμύριοι",
|
||||
"δεκακισμύριοί",
|
||||
"δεκακισμυρίων",
|
||||
"δεκακισμυρίοις",
|
||||
"δεκακισμυρίους",
|
||||
"δεκακισμύριαι",
|
||||
"δεκακισμυρίαις",
|
||||
"δεκακισμυρίας",
|
||||
"δεκακισμύρια",
|
||||
# ANCIENT GREEK NUMBERS (1-100)
|
||||
"α",
|
||||
"β",
|
||||
"γ",
|
||||
"δ",
|
||||
"ε",
|
||||
"ϛ",
|
||||
"ζ",
|
||||
"η",
|
||||
"θ",
|
||||
"ι",
|
||||
"ια",
|
||||
"ιβ",
|
||||
"ιγ",
|
||||
"ιδ",
|
||||
"ιε",
|
||||
"ιϛ",
|
||||
"ιζ",
|
||||
"ιη",
|
||||
"ιθ",
|
||||
"κ",
|
||||
"κα",
|
||||
"κβ",
|
||||
"κγ",
|
||||
"κδ",
|
||||
"κε",
|
||||
"κϛ",
|
||||
"κζ",
|
||||
"κη",
|
||||
"κθ",
|
||||
"λ",
|
||||
"λα",
|
||||
"λβ",
|
||||
"λγ",
|
||||
"λδ",
|
||||
"λε",
|
||||
"λϛ",
|
||||
"λζ",
|
||||
"λη",
|
||||
"λθ",
|
||||
"μ",
|
||||
"μα",
|
||||
"μβ",
|
||||
"μγ",
|
||||
"μδ",
|
||||
"με",
|
||||
"μϛ",
|
||||
"μζ",
|
||||
"μη",
|
||||
"μθ",
|
||||
"ν",
|
||||
"να",
|
||||
"νβ",
|
||||
"νγ",
|
||||
"νδ",
|
||||
"νε",
|
||||
"νϛ",
|
||||
"νζ",
|
||||
"νη",
|
||||
"νθ",
|
||||
"ξ",
|
||||
"ξα",
|
||||
"ξβ",
|
||||
"ξγ",
|
||||
"ξδ",
|
||||
"ξε",
|
||||
"ξϛ",
|
||||
"ξζ",
|
||||
"ξη",
|
||||
"ξθ",
|
||||
"ο",
|
||||
"οα",
|
||||
"οβ",
|
||||
"ογ",
|
||||
"οδ",
|
||||
"οε",
|
||||
"οϛ",
|
||||
"οζ",
|
||||
"οη",
|
||||
"οθ",
|
||||
"π",
|
||||
"πα",
|
||||
"πβ",
|
||||
"πγ",
|
||||
"πδ",
|
||||
"πε",
|
||||
"πϛ",
|
||||
"πζ",
|
||||
"πη",
|
||||
"πθ",
|
||||
"ϟ",
|
||||
"ϟα",
|
||||
"ϟβ",
|
||||
"ϟγ",
|
||||
"ϟδ",
|
||||
"ϟε",
|
||||
"ϟϛ",
|
||||
"ϟζ",
|
||||
"ϟη",
|
||||
"ϟθ",
|
||||
"ρ",
|
||||
]
|
||||
|
||||
|
||||
def like_num(text):
|
||||
if text.lower() in _num_words:
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
LEX_ATTRS = {LIKE_NUM: like_num}
|
61
spacy/lang/grc/stop_words.py
Normal file
61
spacy/lang/grc/stop_words.py
Normal file
|
@ -0,0 +1,61 @@
|
|||
STOP_WORDS = set(
|
||||
"""
|
||||
αὐτῷ αὐτοῦ αὐτῆς αὐτόν αὐτὸν αὐτῶν αὐτὸς αὐτὸ αὐτό αὐτός αὐτὴν αὐτοῖς αὐτοὺς αὔτ' αὐτὰ αὐτῇ αὐτὴ
|
||||
αὐτὼ αὑταὶ καὐτὸς αὐτά αὑτός αὐτοῖσι αὐτοῖσιν αὑτὸς αὐτήν αὐτοῖσί αὐτοί αὐτοὶ αὐτοῖο αὐτάων αὐτὰς
|
||||
αὐτέων αὐτώ αὐτάς αὐτούς αὐτή αὐταί αὐταὶ αὐτῇσιν τὠυτῷ τὠυτὸ ταὐτὰ ταύτῃ αὐτῇσι αὐτῇς αὐταῖς αὐτᾶς αὐτὰν ταὐτὸν
|
||||
|
||||
γε γ' γέ γὰρ γάρ δαῖτα δαιτὸς δαιτὶ δαὶ δαιτί δαῖτ' δαΐδας δαΐδων δἰ διὰ διά δὲ δ' δέ δὴ δή εἰ εἴ κεἰ κεἴ αἴ αἲ εἲ αἰ
|
||||
|
||||
ἐστί ἐστιν ὢν ἦν ἐστὶν ὦσιν εἶναι ὄντι εἰσιν ἐστι ὄντα οὖσαν ἦσαν ἔστι ὄντας ἐστὲ εἰσὶ εἶ ὤν ἦ οὖσαι ἔσται ἐσμὲν ἐστ' ἐστίν ἔστ' ὦ ἔσει ἦμεν εἰμι εἰσὶν ἦσθ'
|
||||
ἐστὶ ᾖ οὖσ' ἔστιν εἰμὶ εἴμ' ἐσθ' ᾖς στί εἴην εἶναί οὖσα κἄστ' εἴη ἦσθα εἰμ' ἔστω ὄντ' ἔσθ' ἔμμεναι ἔω ἐὼν ἐσσι ἔσσεται ἐστὸν ἔσαν ἔστων ἐόντα ἦεν ἐοῦσαν ἔην
|
||||
ἔσσομαι εἰσί ἐστόν ἔσκεν ἐόντ' ἐών ἔσσεσθ' εἰσ' ἐόντες ἐόντε ἐσσεῖται εἰμεν ἔασιν ἔσκε ἔμεναι ἔσεσθαι ἔῃ εἰμὲν εἰσι ἐόντας ἔστε εἰς ἦτε εἰμί ἔσσεαι ἔμμεν
|
||||
ἐοῦσα ἔμεν ᾖσιν ἐστε ἐόντι εἶεν ἔσσονται ἔησθα ἔσεσθε ἐσσί ἐοῦσ' ἔασι ἔα ἦα ἐόν ἔσσεσθαι ἔσομαι ἔσκον εἴης ἔωσιν εἴησαν ἐὸν ἐουσέων ἔσσῃ ἐούσης ἔσονται
|
||||
ἐούσας ἐόντων ἐόντος ἐσομένην ἔστωσαν ἔωσι ἔας ἐοῦσαι ἣν εἰσίν ἤστην ὄντες ὄντων οὔσας οὔσαις ὄντος οὖσι οὔσης ἔσῃ ὂν ἐσμεν ἐσμέν οὖσιν ἐσομένους ἐσσόμεσθα
|
||||
|
||||
ἒς ἐς ἔς ἐν κεἰς εἲς κἀν ἔν κατὰ κατ' καθ' κατά κάτα κὰπ κὰκ κὰδ κὰρ κάρ κὰγ κὰμ καὶ καί μετὰ μεθ' μετ' μέτα μετά μέθ' μέτ' μὲν μέν μὴ
|
||||
|
||||
μή μη οὐκ οὒ οὐ οὐχ οὐχὶ κοὐ κοὐχ οὔ κοὐκ οὐχί οὐκὶ οὐδὲν οὐδεὶς οὐδέν κοὐδεὶς κοὐδὲν οὐδένα οὐδενὸς οὐδέν' οὐδενός οὐδενὶ
|
||||
οὐδεμία οὐδείς οὐδεμίαν οὐδὲ οὐδ' κοὐδ' οὐδέ οὔτε οὔθ' οὔτέ τε οὔτ' οὕτως οὕτω οὕτῶ χοὔτως οὖν ὦν ὧν τοῦτο τοῦθ' τοῦτον τούτῳ
|
||||
τούτοις ταύτας αὕτη ταῦτα οὗτος ταύτης ταύτην τούτων ταῦτ' τοῦτ' τούτου αὗται τούτους τοῦτό ταῦτά τούτοισι χαὔτη ταῦθ' χοὖτοι
|
||||
τούτοισιν οὗτός οὗτοι τούτω τουτέων τοῦτὸν οὗτοί τοῦτου οὗτοὶ ταύτῃσι ταύταις ταυτὶ παρὰ παρ' πάρα παρά πὰρ παραὶ πάρ' περὶ
|
||||
πέρι περί πρὸς πρός ποτ' ποτὶ προτὶ προτί πότι
|
||||
|
||||
σὸς σήν σὴν σὸν σόν σὰ σῶν σοῖσιν σός σῆς σῷ σαῖς σῇ σοῖς σοῦ σ' σὰν σά σὴ σὰς
|
||||
σᾷ σοὺς σούς σοῖσι σῇς σῇσι σή σῇσιν σοὶ σου ὑμεῖς σὲ σύ σοι ὑμᾶς ὑμῶν ὑμῖν σε
|
||||
σέ σὺ σέθεν σοί ὑμὶν σφῷν ὑμίν τοι τοὶ σφὼ ὔμμ' σφῶϊ σεῖο τ' σφῶϊν ὔμμιν σέο σευ σεῦ
|
||||
ὔμμι ὑμέων τύνη ὑμείων τοί ὔμμες σεο τέ τεοῖο ὑμέας σὺν ξὺν σύν
|
||||
|
||||
θ' τί τι τις τινες τινα τινος τινὸς τινὶ τινῶν τίς τίνες τινὰς τιν' τῳ του τίνα τοῦ τῷ τινί τινά τίνος τινι τινας τινὰ τινων
|
||||
τίν' τευ τέο τινές τεο τινὲς τεῷ τέῳ τινός τεῳ τισὶ
|
||||
|
||||
τοιαῦτα τοιοῦτον τοιοῦθ' τοιοῦτος τοιαύτην τοιαῦτ' τοιούτου τοιαῦθ' τοιαύτῃ τοιούτοις τοιαῦται τοιαῦτά τοιαύτη τοιοῦτοι τοιούτων τοιούτοισι
|
||||
τοιοῦτο τοιούτους τοιούτῳ τοιαύτης τοιαύταις τοιαύτας τοιοῦτός τίνι τοῖσι τίνων τέων τέοισί τὰ τῇ τώ τὼ
|
||||
|
||||
ἀλλὰ ἀλλ' ἀλλά ἀπ' ἀπὸ κἀπ' ἀφ' τἀπὸ κἀφ' ἄπο ἀπό τὠπὸ τἀπ' ἄλλων ἄλλῳ ἄλλη ἄλλης ἄλλους ἄλλοις ἄλλον ἄλλο ἄλλου τἄλλα ἄλλα
|
||||
ἄλλᾳ ἄλλοισιν τἄλλ' ἄλλ' ἄλλος ἄλλοισι κἄλλ' ἄλλοι ἄλλῃσι ἄλλόν ἄλλην ἄλλά ἄλλαι ἄλλοισίν ὧλλοι ἄλλῃ ἄλλας ἀλλέων τἆλλα ἄλλως
|
||||
ἀλλάων ἄλλαις τἆλλ'
|
||||
|
||||
ἂν ἄν κἂν τἂν ἃν κεν κ' κέν κέ κε χ' ἄρα τἄρα ἄρ' τἄρ' ἄρ ῥα ῥά ῥ τὰρ ἄρά ἂρ
|
||||
|
||||
ἡμᾶς με ἐγὼ ἐμὲ μοι κἀγὼ ἡμῶν ἡμεῖς ἐμοὶ ἔγωγ' ἁμοὶ ἡμῖν μ' ἔγωγέ ἐγώ ἐμοί ἐμοῦ κἀμοῦ ἔμ' κἀμὲ ἡμὶν μου ἐμέ ἔγωγε νῷν νὼ χἠμεῖς ἁμὲ κἀγώ κἀμοὶ χἠμᾶς
|
||||
ἁγὼ ἡμίν κἄμ' ἔμοιγ' μοί τοὐμὲ ἄμμε ἐγὼν ἐμεῦ ἐμεῖο μευ ἔμοιγε ἄμμι μέ ἡμέας νῶϊ ἄμμιν ἧμιν ἐγών νῶΐ ἐμέθεν ἥμιν ἄμμες νῶι ἡμείων ἄμμ' ἡμέων ἐμέο
|
||||
ἐκ ἔκ ἐξ κἀκ κ ἃκ κἀξ ἔξ εξ Ἐκ τἀμὰ ἐμοῖς τοὐμόν ἐμᾶς τοὐμὸν ἐμῶν ἐμὸς ἐμῆς ἐμῷ τὠμῷ ἐμὸν τἄμ' ἐμὴ ἐμὰς ἐμαῖς ἐμὴν ἐμόν ἐμὰ ἐμός ἐμοὺς ἐμῇ ἐμᾷ
|
||||
οὑμὸς ἐμοῖν οὑμός κἀμὸν ἐμαὶ ἐμή ἐμάς ἐμοῖσι ἐμοῖσιν ἐμῇσιν ἐμῇσι ἐμῇς ἐμήν
|
||||
|
||||
ἔνι ἐνὶ εἰνὶ εἰν ἐμ ἐπὶ ἐπ' ἔπι ἐφ' κἀπὶ τἀπὶ ἐπί ἔφ' ἔπ' ἐὰν ἢν ἐάν ἤν ἄνπερ
|
||||
|
||||
αὑτοῖς αὑτὸν αὑτῷ ἑαυτοῦ αὑτόν αὑτῆς αὑτῶν αὑτοῦ αὑτὴν αὑτοῖν χαὐτοῦ αὑταῖς ἑωυτοῦ ἑωυτῇ ἑωυτὸν ἐωυτῷ ἑωυτῆς ἑωυτόν ἑωυτῷ
|
||||
ἑωυτάς ἑωυτῶν ἑωυτοὺς ἑωυτοῖσι ἑαυτῇ ἑαυτούς αὑτοὺς ἑαυτῶν ἑαυτοὺς ἑαυτὸν ἑαυτῷ ἑαυτοῖς ἑαυτὴν ἑαυτῆς
|
||||
|
||||
ἔτι ἔτ' ἔθ' κἄτι ἢ ἤ ἠέ ἠὲ ἦε ἦέ ἡ τοὺς τὴν τὸ τῶν τὸν ὁ ἁ οἱ τοῖς ταῖς τῆς τὰς αἱ τό τὰν τᾶς τοῖσιν αἳ χὠ τήν τά τοῖν τάς ὅ
|
||||
χοἰ ἣ ἥ χἠ τάν τᾶν ὃ οἳ οἵ τοῖο τόν τοῖιν τούς τάων ταὶ τῇς τῇσι τῇσιν αἵ τοῖό τοῖσίν ὅττί ταί Τὴν τῆ τῶ τάδε ὅδε τοῦδε τόδε τόνδ'
|
||||
τάδ' τῆσδε τῷδε ὅδ' τῶνδ' τῇδ' τοῦδέ τῶνδε τόνδε τόδ' τοῦδ' τάσδε τήνδε τάσδ' τήνδ' ταῖσδέ τῇδε τῆσδ' τάνδ' τῷδ' τάνδε ἅδε τοῖσδ' ἥδ'
|
||||
τᾷδέ τοῖσδε τούσδ' ἥδε τούσδε τώδ' ἅδ' οἵδ' τῶνδέ οἵδε τᾷδε τοῖσδεσσι τώδε τῇδέ τοῖσιδε αἵδε τοῦδὲ τῆδ' αἵδ' τοῖσδεσι ὃν ἃ ὃς ᾧ οὗ ἅπερ
|
||||
οὓς ἧς οἷς ἅσπερ ᾗ ἅ χὦνπερ ὣ αἷς ᾇ ὅς ἥπερ ἃς ὅσπερ ὅνπερ ὧνπερ ᾧπερ ὅν αἷν οἷσι ἇς ἅς ὥ οὕς ἥν οἷσιν ἕης ὅου ᾗς οἷσί οἷσίν τοῖσί ᾗσιν οἵπερ αἷσπερ
|
||||
ὅστις ἥτις ὅτου ὅτοισι ἥντιν' ὅτῳ ὅντιν' ὅττι ἅσσά ὅτεῳ ὅτις ὅτιν' ὅτευ ἥντινα αἵτινές ὅντινα ἅσσα ᾧτινι οἵτινες ὅτι ἅτις ὅτ' ὑμὴ
|
||||
ὑμήν ὑμὸν ὑπὲρ ὕπερ ὑπέρτερον ὑπεὶρ ὑπέρτατος ὑπὸ ὑπ' ὑφ' ὕπο ὑπαὶ ὑπό ὕπ' ὕφ'
|
||||
|
||||
ὣς ὡς ὥς ὧς ὥστ' ὥστε ὥσθ' ὤ ὢ
|
||||
|
||||
""".split()
|
||||
)
|
23
spacy/lang/grc/test_text.py
Normal file
23
spacy/lang/grc/test_text.py
Normal file
|
@ -0,0 +1,23 @@
|
|||
import pytest
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"text,match",
|
||||
[
|
||||
("ι", True),
|
||||
("α", True),
|
||||
("ϟα", True),
|
||||
("ἑκατόν", True),
|
||||
("ἐνακόσια", True),
|
||||
("δισχίλια", True),
|
||||
("μύρια", True),
|
||||
("εἷς", True),
|
||||
("λόγος", False),
|
||||
(",", False),
|
||||
("λβ", True),
|
||||
],
|
||||
)
|
||||
def test_lex_attrs_like_number(grc_tokenizer, text, match):
|
||||
tokens = grc_tokenizer(text)
|
||||
assert len(tokens) == 1
|
||||
assert tokens[0].like_num == match
|
115
spacy/lang/grc/tokenizer_exceptions.py
Normal file
115
spacy/lang/grc/tokenizer_exceptions.py
Normal file
|
@ -0,0 +1,115 @@
|
|||
from ..tokenizer_exceptions import BASE_EXCEPTIONS
|
||||
from ...symbols import ORTH, NORM
|
||||
from ...util import update_exc
|
||||
|
||||
_exc = {}
|
||||
|
||||
for token in ["᾽Απ'", "᾽ΑΠ'", "ἀφ'", "᾽Αφ", "ἀπὸ"]:
|
||||
_exc[token] = [{ORTH: token, NORM: "από"}]
|
||||
|
||||
for token in ["᾽Αλλ'", "ἀλλ'", "ἀλλὰ"]:
|
||||
_exc[token] = [{ORTH: token, NORM: "ἀλλά"}]
|
||||
|
||||
for token in ["παρ'", "Παρ'", "παρὰ", "παρ"]:
|
||||
_exc[token] = [{ORTH: token, NORM: "παρά"}]
|
||||
|
||||
for token in ["καθ'", "Καθ'", "κατ'", "Κατ'", "κατὰ"]:
|
||||
_exc[token] = [{ORTH: token, NORM: "κατά"}]
|
||||
|
||||
for token in ["Ἐπ'", "ἐπ'", "ἐπὶ", "Εφ'", "εφ'"]:
|
||||
_exc[token] = [{ORTH: token, NORM: "επί"}]
|
||||
|
||||
for token in ["Δι'", "δι'", "διὰ"]:
|
||||
_exc[token] = [{ORTH: token, NORM: "διά"}]
|
||||
|
||||
for token in ["Ὑπ'", "ὑπ'", "ὑφ'"]:
|
||||
_exc[token] = [{ORTH: token, NORM: "ὑπό"}]
|
||||
|
||||
for token in ["Μετ'", "μετ'", "μεθ'", "μετὰ"]:
|
||||
_exc[token] = [{ORTH: token, NORM: "μετά"}]
|
||||
|
||||
for token in ["Μ'", "μ'", "μέ", "μὲ"]:
|
||||
_exc[token] = [{ORTH: token, NORM: "με"}]
|
||||
|
||||
for token in ["Σ'", "σ'", "σέ", "σὲ"]:
|
||||
_exc[token] = [{ORTH: token, NORM: "σε"}]
|
||||
|
||||
for token in ["Τ'", "τ'", "τέ", "τὲ"]:
|
||||
_exc[token] = [{ORTH: token, NORM: "τε"}]
|
||||
|
||||
for token in ["Δ'", "δ'", "δὲ"]:
|
||||
_exc[token] = [{ORTH: token, NORM: "δέ"}]
|
||||
|
||||
|
||||
_other_exc = {
|
||||
"μὲν": [{ORTH: "μὲν", NORM: "μέν"}],
|
||||
"μὴν": [{ORTH: "μὴν", NORM: "μήν"}],
|
||||
"τὴν": [{ORTH: "τὴν", NORM: "τήν"}],
|
||||
"τὸν": [{ORTH: "τὸν", NORM: "τόν"}],
|
||||
"καὶ": [{ORTH: "καὶ", NORM: "καί"}],
|
||||
"καὐτός": [{ORTH: "κ", NORM: "καί"}, {ORTH: "αὐτός"}],
|
||||
"καὐτὸς": [{ORTH: "κ", NORM: "καί"}, {ORTH: "αὐτὸς", NORM: "αὐτός"}],
|
||||
"κοὐ": [{ORTH: "κ", NORM: "καί"}, {ORTH: "οὐ"}],
|
||||
"χἡ": [{ORTH: "χ", NORM: "καί"}, {ORTH: "ἡ"}],
|
||||
"χοἱ": [{ORTH: "χ", NORM: "καί"}, {ORTH: "οἱ"}],
|
||||
"χἱκετεύετε": [{ORTH: "χ", NORM: "καί"}, {ORTH: "ἱκετεύετε"}],
|
||||
"κἀν": [{ORTH: "κ", NORM: "καί"}, {ORTH: "ἀν", NORM: "ἐν"}],
|
||||
"κἀγὼ": [{ORTH: "κἀ", NORM: "καί"}, {ORTH: "γὼ", NORM: "ἐγώ"}],
|
||||
"κἀγώ": [{ORTH: "κἀ", NORM: "καί"}, {ORTH: "γώ", NORM: "ἐγώ"}],
|
||||
"ἁγώ": [{ORTH: "ἁ", NORM: "ἃ"}, {ORTH: "γώ", NORM: "ἐγώ"}],
|
||||
"ἁγὼ": [{ORTH: "ἁ", NORM: "ἃ"}, {ORTH: "γὼ", NORM: "ἐγώ"}],
|
||||
"ἐγᾦδα": [{ORTH: "ἐγ", NORM: "ἐγώ"}, {ORTH: "ᾦδα", NORM: "οἶδα"}],
|
||||
"ἐγᾦμαι": [{ORTH: "ἐγ", NORM: "ἐγώ"}, {ORTH: "ᾦμαι", NORM: "οἶμαι"}],
|
||||
"κἀς": [{ORTH: "κ", NORM: "καί"}, {ORTH: "ἀς", NORM: "ἐς"}],
|
||||
"κᾆτα": [{ORTH: "κ", NORM: "καί"}, {ORTH: "ᾆτα", NORM: "εἶτα"}],
|
||||
"κεἰ": [{ORTH: "κ", NORM: "καί"}, {ORTH: "εἰ"}],
|
||||
"κεἰς": [{ORTH: "κ", NORM: "καί"}, {ORTH: "εἰς"}],
|
||||
"χὤτε": [{ORTH: "χ", NORM: "καί"}, {ORTH: "ὤτε", NORM: "ὅτε"}],
|
||||
"χὤπως": [{ORTH: "χ", NORM: "καί"}, {ORTH: "ὤπως", NORM: "ὅπως"}],
|
||||
"χὤτι": [{ORTH: "χ", NORM: "καί"}, {ORTH: "ὤτι", NORM: "ὅτι"}],
|
||||
"χὤταν": [{ORTH: "χ", NORM: "καί"}, {ORTH: "ὤταν", NORM: "ὅταν"}],
|
||||
"οὑμός": [{ORTH: "οὑ", NORM: "ὁ"}, {ORTH: "μός", NORM: "ἐμός"}],
|
||||
"οὑμὸς": [{ORTH: "οὑ", NORM: "ὁ"}, {ORTH: "μὸς", NORM: "ἐμός"}],
|
||||
"οὑμοί": [{ORTH: "οὑ", NORM: "οἱ"}, {ORTH: "μοί", NORM: "ἐμoί"}],
|
||||
"οὑμοὶ": [{ORTH: "οὑ", NORM: "οἱ"}, {ORTH: "μοὶ", NORM: "ἐμoί"}],
|
||||
"σοὔστι": [{ORTH: "σοὔ", NORM: "σοί"}, {ORTH: "στι", NORM: "ἐστι"}],
|
||||
"σοὐστί": [{ORTH: "σοὐ", NORM: "σοί"}, {ORTH: "στί", NORM: "ἐστί"}],
|
||||
"σοὐστὶ": [{ORTH: "σοὐ", NORM: "σοί"}, {ORTH: "στὶ", NORM: "ἐστί"}],
|
||||
"μοὖστι": [{ORTH: "μοὖ", NORM: "μοί"}, {ORTH: "στι", NORM: "ἐστι"}],
|
||||
"μοὔστι": [{ORTH: "μοὔ", NORM: "μοί"}, {ORTH: "στι", NORM: "ἐστι"}],
|
||||
"τοὔνομα": [{ORTH: "τοὔ", NORM: "τό"}, {ORTH: "νομα", NORM: "ὄνομα"}],
|
||||
"οὑν": [{ORTH: "οὑ", NORM: "ὁ"}, {ORTH: "ν", NORM: "ἐν"}],
|
||||
"ὦνερ": [{ORTH: "ὦ", NORM: "ὦ"}, {ORTH: "νερ", NORM: "ἄνερ"}],
|
||||
"ὦνδρες": [{ORTH: "ὦ", NORM: "ὦ"}, {ORTH: "νδρες", NORM: "ἄνδρες"}],
|
||||
"προὔχων": [{ORTH: "προὔ", NORM: "πρό"}, {ORTH: "χων", NORM: "ἔχων"}],
|
||||
"προὔχοντα": [{ORTH: "προὔ", NORM: "πρό"}, {ORTH: "χοντα", NORM: "ἔχοντα"}],
|
||||
"ὥνεκα": [{ORTH: "ὥ", NORM: "οὗ"}, {ORTH: "νεκα", NORM: "ἕνεκα"}],
|
||||
"θοἰμάτιον": [{ORTH: "θο", NORM: "τό"}, {ORTH: "ἰμάτιον"}],
|
||||
"ὥνεκα": [{ORTH: "ὥ", NORM: "οὗ"}, {ORTH: "νεκα", NORM: "ἕνεκα"}],
|
||||
"τὠληθές": [{ORTH: "τὠ", NORM: "τὸ"}, {ORTH: "ληθές", NORM: "ἀληθές"}],
|
||||
"θἡμέρᾳ": [{ORTH: "θ", NORM: "τῇ"}, {ORTH: "ἡμέρᾳ"}],
|
||||
"ἅνθρωπος": [{ORTH: "ἅ", NORM: "ὁ"}, {ORTH: "νθρωπος", NORM: "ἄνθρωπος"}],
|
||||
"τἄλλα": [{ORTH: "τ", NORM: "τὰ"}, {ORTH: "ἄλλα"}],
|
||||
"τἆλλα": [{ORTH: "τἆ", NORM: "τὰ"}, {ORTH: "λλα", NORM: "ἄλλα"}],
|
||||
"ἁνήρ": [{ORTH: "ἁ", NORM: "ὁ"}, {ORTH: "νήρ", NORM: "ἀνήρ"}],
|
||||
"ἁνὴρ": [{ORTH: "ἁ", NORM: "ὁ"}, {ORTH: "νὴρ", NORM: "ἀνήρ"}],
|
||||
"ἅνδρες": [{ORTH: "ἅ", NORM: "οἱ"}, {ORTH: "νδρες", NORM: "ἄνδρες"}],
|
||||
"ἁγαθαί": [{ORTH: "ἁ", NORM: "αἱ"}, {ORTH: "γαθαί", NORM: "ἀγαθαί"}],
|
||||
"ἁγαθαὶ": [{ORTH: "ἁ", NORM: "αἱ"}, {ORTH: "γαθαὶ", NORM: "ἀγαθαί"}],
|
||||
"ἁλήθεια": [{ORTH: "ἁ", NORM: "ἡ"}, {ORTH: "λήθεια", NORM: "ἀλήθεια"}],
|
||||
"τἀνδρός": [{ORTH: "τ", NORM: "τοῦ"}, {ORTH: "ἀνδρός"}],
|
||||
"τἀνδρὸς": [{ORTH: "τ", NORM: "τοῦ"}, {ORTH: "ἀνδρὸς", NORM: "ἀνδρός"}],
|
||||
"τἀνδρί": [{ORTH: "τ", NORM: "τῷ"}, {ORTH: "ἀνδρί"}],
|
||||
"τἀνδρὶ": [{ORTH: "τ", NORM: "τῷ"}, {ORTH: "ἀνδρὶ", NORM: "ἀνδρί"}],
|
||||
"αὑτός": [{ORTH: "αὑ", NORM: "ὁ"}, {ORTH: "τός", NORM: "αὐτός"}],
|
||||
"αὑτὸς": [{ORTH: "αὑ", NORM: "ὁ"}, {ORTH: "τὸς", NORM: "αὐτός"}],
|
||||
"ταὐτοῦ": [{ORTH: "τ", NORM: "τοῦ"}, {ORTH: "αὐτοῦ"}],
|
||||
}
|
||||
|
||||
_exc.update(_other_exc)
|
||||
|
||||
_exc_data = {}
|
||||
|
||||
_exc.update(_exc_data)
|
||||
|
||||
TOKENIZER_EXCEPTIONS = update_exc(BASE_EXCEPTIONS, _exc)
|
|
@ -123,6 +123,11 @@ def fr_tokenizer():
|
|||
@pytest.fixture(scope="session")
|
||||
def ga_tokenizer():
|
||||
return get_lang_class("ga")().tokenizer
|
||||
|
||||
|
||||
@pytest.fixture(scope="session")
|
||||
def grc_tokenizer():
|
||||
return get_lang_class("grc")().tokenizer
|
||||
|
||||
|
||||
@pytest.fixture(scope="session")
|
||||
|
|
0
spacy/tests/lang/grc/__init__.py
Normal file
0
spacy/tests/lang/grc/__init__.py
Normal file
23
spacy/tests/lang/grc/test_text.py
Normal file
23
spacy/tests/lang/grc/test_text.py
Normal file
|
@ -0,0 +1,23 @@
|
|||
import pytest
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"text,match",
|
||||
[
|
||||
("ι", True),
|
||||
("α", True),
|
||||
("ϟα", True),
|
||||
("ἑκατόν", True),
|
||||
("ἐνακόσια", True),
|
||||
("δισχίλια", True),
|
||||
("μύρια", True),
|
||||
("εἷς", True),
|
||||
("λόγος", False),
|
||||
(",", False),
|
||||
("λβ", True),
|
||||
],
|
||||
)
|
||||
def test_lex_attrs_like_number(grc_tokenizer, text, match):
|
||||
tokens = grc_tokenizer(text)
|
||||
assert len(tokens) == 1
|
||||
assert tokens[0].like_num == match
|
Loading…
Reference in New Issue
Block a user