grecy installs six ancient Greek spaCy models that were trained using the Universal Dependency Proiel and Perseus treebanks.
Project description
greCy
Ancient Greek models for spaCy
greCy is a set of spaCy ancient Greek models and its installer. The models were trained using the Perseus and Proiel UD corpora.
Installation
First install the python package as usual:
pip install -U grecy
Once the package is successfully installed, you can proceed to install any of the followings models:
- grc_perseus_sm
- grc_proiel_sm
- grc_perseus_lg
- grc_proiel_lg
- grc_perseus_trf
- grc_proiel_trf
The models can be installed from the terminal with the commands below:
python -m grecy install MODEL
where you replace MODEL by any of the model names listed above. The suffixes after the corpus name _sm, _lg, and _trf indicate the size of the model, which directly depends on the word embeddings used to train the models. The smallest models end in _sm (small) and are the less accurate ones: they are good for testing and building lightweight apps. The _lg and _trf are the large and transformer models which are more accurate. The _lg were trained using floret word vectors, and the _trf models use a special version of BERT that was pretrained with the largest Ancient Greek corpus available in the web.
Loading
As usual, you can load any of the six models with the following Python lines:
import spacy
nlp = spacy.load("grc_proiel_XX")
Remember to replace _XX with the size of the model you would like to use, this means, _sm for small, _lg for large, and _trf for transformer. The _trf model is the most accurate but also the slowest.
Use
spaCy is a powerful NLP library with many applications. The most basic of its function is the morpho-syntantic annotation of texts for further processing. A common routine is to load a model, create a doc object, and process a text:
import spacy
nlp = spacy.load("grc_proiel_trf")
text = "καὶ πρὶν μὲν ἐν κακοῖσι κειμένην ὅμως ἐλπίς μʼ ἀεὶ προσῆγε σωθέντος τέκνου ἀλκήν τινʼ εὑρεῖν κἀπικούρησιν δόμον"
doc = nlp(text)
for token in doc:
print(f'{token.text}, lemma: {token.lemma_} pos:{token.pos_}')
The apostrophe issue
Unfortunately, there is no consensus how to represent the Ancient Greek apostrophe. Modern Greek simply uses the regular apostrophe, but ancient texts available in Perseus and Perseus under Philologic use various unicode characters for the apostrophe. Instead of the apostrophe, we find the 'Greek koronis', 'modifier letter apostrophe', and 'right single quotation mark.' Provisionally, I have opted to use 'modifier letter apostrophe' in the corpora with which I trained the models. This means that, if you want the greCy models to properly handle the apostrophe, you have to make sure that the Ancient Greek texts that you are processing use the modifier letter apostrophe ʼ (U+02BC ). Otherwise the models will fail to lemmatize and tag some words in your texts that ends with an 'apostrophe'.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file grecy-1.0.tar.gz.
File metadata
- Download URL: grecy-1.0.tar.gz
- Upload date:
- Size: 5.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dcf52f710befaa8edc9cd38ae3f4b14eb643e60adf09051174ce044deca90289
|
|
| MD5 |
cfc6fd8c8fa775d20f25efad6920c05d
|
|
| BLAKE2b-256 |
f3268f4a1e843ff9560e5169d971814adf01373d28488d9c7cab22a2341fcfdd
|
File details
Details for the file grecy-1.0-py3-none-any.whl.
File metadata
- Download URL: grecy-1.0-py3-none-any.whl
- Upload date:
- Size: 6.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
21b3c1fa294220d1b206fa01e1df8b2d5647072191e735538dbfbe6952676ac1
|
|
| MD5 |
ac6a912132cf0f8e625eb158b3cd7b12
|
|
| BLAKE2b-256 |
b50f2e15089dbe7d5f359ba556a108e287355a6473f6de1d69ad8027fdead157
|