grecy 1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
grecy-1.0/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023 Jacobo Myerston
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
grecy-1.0/PKG-INFO ADDED
@@ -0,0 +1,108 @@
1
+ Metadata-Version: 2.1
2
+ Name: grecy
3
+ Version: 1.0
4
+ Summary: grecy installs six ancient Greek spaCy models that were trained using the Universal Dependency Proiel and Perseus treebanks.
5
+ Author-email: Jacobo Myerston <jmyerston@ucsd.edu>
6
+ License: MIT License
7
+
8
+ Copyright (c) 2023 Jacobo Myerston
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ of this software and associated documentation files (the "Software"), to deal
12
+ in the Software without restriction, including without limitation the rights
13
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ copies of the Software, and to permit persons to whom the Software is
15
+ furnished to do so, subject to the following conditions:
16
+
17
+ The above copyright notice and this permission notice shall be included in all
18
+ copies or substantial portions of the Software.
19
+
20
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
+ SOFTWARE.
27
+
28
+ Project-URL: Homepage, https://github.com/jmyerston/greCy
29
+ Project-URL: Bug Tracker, https://github.com/jmyerston/greCy/issues
30
+ Classifier: Programming Language :: Python :: 3
31
+ Classifier: License :: OSI Approved :: MIT License
32
+ Classifier: Operating System :: OS Independent
33
+ Requires-Python: >=3.10
34
+ Description-Content-Type: text/markdown
35
+ License-File: LICENSE.txt
36
+
37
+ # greCy
38
+ ## Ancient Greek models for spaCy
39
+
40
+ greCy is a set of spaCy ancient Greek models and its installer. The models were trained using the [Perseus](https://universaldependencies.org/treebanks/grc_perseus/index.html) and [Proiel UD](https://universaldependencies.org/treebanks/grc_proiel/index.html) corpora.
41
+
42
+ ### Installation
43
+
44
+ First install the python package as usual:
45
+
46
+ ``` bash
47
+ pip install -U grecy
48
+ ```
49
+
50
+ Once the package is successfully installed, you can proceed to install any of the followings models:
51
+
52
+ * grc_perseus_sm
53
+ * grc_proiel_sm
54
+ * grc_perseus_lg
55
+ * grc_proiel_lg
56
+ * grc_perseus_trf
57
+ * grc_proiel_trf
58
+
59
+
60
+ The models can be installed from the terminal with the commands below:
61
+
62
+ ```
63
+ python -m grecy install MODEL
64
+ ```
65
+ 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.
66
+
67
+
68
+ ### Loading
69
+
70
+ As usual, you can load any of the six models with the following Python lines:
71
+
72
+ ```
73
+ import spacy
74
+ nlp = spacy.load("grc_proiel_XX")
75
+ ```
76
+ 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.
77
+
78
+ ### Use
79
+
80
+ 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:
81
+
82
+ ```
83
+ import spacy
84
+ nlp = spacy.load("grc_proiel_trf")
85
+
86
+ text = "καὶ πρὶν μὲν ἐν κακοῖσι κειμένην ὅμως ἐλπίς μʼ ἀεὶ προσῆγε σωθέντος τέκνου ἀλκήν τινʼ εὑρεῖν κἀπικούρησιν δόμον"
87
+
88
+ doc = nlp(text)
89
+
90
+ for token in doc:
91
+ print(f'{token.text}, lemma: {token.lemma_} pos:{token.pos_}')
92
+
93
+ ```
94
+
95
+ #### The apostrophe issue
96
+
97
+ 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'.
98
+
99
+
100
+
101
+
102
+
103
+
104
+
105
+
106
+
107
+
108
+
grecy-1.0/README.md ADDED
@@ -0,0 +1,72 @@
1
+ # greCy
2
+ ## Ancient Greek models for spaCy
3
+
4
+ greCy is a set of spaCy ancient Greek models and its installer. The models were trained using the [Perseus](https://universaldependencies.org/treebanks/grc_perseus/index.html) and [Proiel UD](https://universaldependencies.org/treebanks/grc_proiel/index.html) corpora.
5
+
6
+ ### Installation
7
+
8
+ First install the python package as usual:
9
+
10
+ ``` bash
11
+ pip install -U grecy
12
+ ```
13
+
14
+ Once the package is successfully installed, you can proceed to install any of the followings models:
15
+
16
+ * grc_perseus_sm
17
+ * grc_proiel_sm
18
+ * grc_perseus_lg
19
+ * grc_proiel_lg
20
+ * grc_perseus_trf
21
+ * grc_proiel_trf
22
+
23
+
24
+ The models can be installed from the terminal with the commands below:
25
+
26
+ ```
27
+ python -m grecy install MODEL
28
+ ```
29
+ 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.
30
+
31
+
32
+ ### Loading
33
+
34
+ As usual, you can load any of the six models with the following Python lines:
35
+
36
+ ```
37
+ import spacy
38
+ nlp = spacy.load("grc_proiel_XX")
39
+ ```
40
+ 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.
41
+
42
+ ### Use
43
+
44
+ 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:
45
+
46
+ ```
47
+ import spacy
48
+ nlp = spacy.load("grc_proiel_trf")
49
+
50
+ text = "καὶ πρὶν μὲν ἐν κακοῖσι κειμένην ὅμως ἐλπίς μʼ ἀεὶ προσῆγε σωθέντος τέκνου ἀλκήν τινʼ εὑρεῖν κἀπικούρησιν δόμον"
51
+
52
+ doc = nlp(text)
53
+
54
+ for token in doc:
55
+ print(f'{token.text}, lemma: {token.lemma_} pos:{token.pos_}')
56
+
57
+ ```
58
+
59
+ #### The apostrophe issue
60
+
61
+ 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'.
62
+
63
+
64
+
65
+
66
+
67
+
68
+
69
+
70
+
71
+
72
+
File without changes
@@ -0,0 +1,126 @@
1
+ import typer
2
+ import subprocess
3
+ import sys
4
+ from .utilities.connections import access_to
5
+
6
+ app = typer.Typer()
7
+
8
+ @app.command()
9
+ def install(model: str):
10
+
11
+ models = ["grc_perseus_sm","grc_perseus_lg","grc_perseus_trf","grc_proiel_sm","grc_proiel_lg","grc_proiel_trf"]
12
+
13
+ hf_url = "https://huggingface.co/"
14
+
15
+ if model in models:
16
+
17
+ # Checking the access to Hugging Face
18
+ if not access_to(hf_url):
19
+ print(f'The access to {hf_url} is not possible.')
20
+ print(f'Please, check the network connection.')
21
+ exit(0)
22
+
23
+ # The url for the model
24
+ https = hf_url + "Jacobo/" + model + "/resolve/main/" + model + "-any-py3-none-any.whl"
25
+
26
+ # The pip command
27
+ pip_command = "python -m pip install " + https
28
+
29
+ try:
30
+ process = subprocess.Popen(pip_command.split(" "),
31
+ bufsize=1,
32
+ stdout=subprocess.PIPE,
33
+ stderr=subprocess.PIPE,
34
+ universal_newlines=True)
35
+ except Exception as e:
36
+
37
+ print(f'There is a problem with the command: {pip_command}')
38
+ print(f'Below the related information:')
39
+ print(f'{str(e)}')
40
+
41
+ else:
42
+
43
+ finished = process.poll()
44
+
45
+ if not finished:
46
+
47
+ print('\n' + f'Installing {model}.....')
48
+ print('\n' + f'Please wait, this could take some minutes.....' + '\n')
49
+
50
+ while True:
51
+
52
+ msg = process.stdout.readline()
53
+ print(msg.strip())
54
+ return_code = process.poll()
55
+ if return_code is not None:
56
+ # The model was successfully installed
57
+ # Printing the rest of the installation's output:
58
+ for msg in process.stdout.readlines():
59
+ print(msg.strip())
60
+ break
61
+
62
+ else:
63
+ print(f'The model: {model} can not be installed' + '\n')
64
+ print("Please, check the model's name in the address below." + '\n')
65
+ print(https + '\n')
66
+ print('Error CODE', error, '\n')
67
+ # The model can not be installed
68
+ # Printing the rest of the error's output:
69
+ for msg in process.stderr.readline():
70
+ print(msg)
71
+ else:
72
+ print('\n' + f'Please, check the model required. The options in greCy are:')
73
+ print([model for model in models])
74
+
75
+
76
+ @app.command()
77
+ def uninstall(model: str):
78
+
79
+ models = ["grc_perseus_sm","grc_perseus_lg","grc_perseus_trf","grc_proiel_sm","grc_proiel_lg","grc_proiel_trf"]
80
+
81
+ if model in models:
82
+
83
+ pip_command = "python -m pip uninstall --yes " + model
84
+
85
+ try:
86
+ process = subprocess.Popen(pip_command.split(" "),
87
+ bufsize=1,
88
+ stdout=subprocess.PIPE,
89
+ stderr=subprocess.PIPE,
90
+ universal_newlines=True)
91
+ except Exception as e:
92
+
93
+ print(f'There is a problem with the command: {pip_command}')
94
+ print(f'Below the related information:')
95
+ print(f'{str(e)}')
96
+
97
+ else:
98
+
99
+ error = process.stderr.readline()
100
+
101
+ if error:
102
+ print(error)
103
+ exit(0)
104
+
105
+ else:
106
+
107
+ while True:
108
+
109
+ msg = process.stdout.readline()
110
+ print(msg)
111
+ return_code = process.poll()
112
+
113
+ if return_code is not None:
114
+ # The model has been uninstalled.
115
+ # Printing the rest of the output:
116
+ for msg in process.stdout.readlines():
117
+ print(msg)
118
+ break
119
+ else:
120
+ print(f'The model: {model} can not be uninstalled' + "\n")
121
+ print(f'Please, check the model. The options in greCy are:')
122
+ print([model for model in models])
123
+
124
+ if __name__ == "__main__":
125
+
126
+ app()
File without changes
@@ -0,0 +1,12 @@
1
+ import urllib.request
2
+
3
+
4
+ def access_to(url: str):
5
+ # trying to open gfg
6
+ try:
7
+ urllib.request.urlopen(url)
8
+ return True
9
+
10
+ # trying to catch exception when internet is not ON.
11
+ except:
12
+ return False
@@ -0,0 +1,108 @@
1
+ Metadata-Version: 2.1
2
+ Name: grecy
3
+ Version: 1.0
4
+ Summary: grecy installs six ancient Greek spaCy models that were trained using the Universal Dependency Proiel and Perseus treebanks.
5
+ Author-email: Jacobo Myerston <jmyerston@ucsd.edu>
6
+ License: MIT License
7
+
8
+ Copyright (c) 2023 Jacobo Myerston
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ of this software and associated documentation files (the "Software"), to deal
12
+ in the Software without restriction, including without limitation the rights
13
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ copies of the Software, and to permit persons to whom the Software is
15
+ furnished to do so, subject to the following conditions:
16
+
17
+ The above copyright notice and this permission notice shall be included in all
18
+ copies or substantial portions of the Software.
19
+
20
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
+ SOFTWARE.
27
+
28
+ Project-URL: Homepage, https://github.com/jmyerston/greCy
29
+ Project-URL: Bug Tracker, https://github.com/jmyerston/greCy/issues
30
+ Classifier: Programming Language :: Python :: 3
31
+ Classifier: License :: OSI Approved :: MIT License
32
+ Classifier: Operating System :: OS Independent
33
+ Requires-Python: >=3.10
34
+ Description-Content-Type: text/markdown
35
+ License-File: LICENSE.txt
36
+
37
+ # greCy
38
+ ## Ancient Greek models for spaCy
39
+
40
+ greCy is a set of spaCy ancient Greek models and its installer. The models were trained using the [Perseus](https://universaldependencies.org/treebanks/grc_perseus/index.html) and [Proiel UD](https://universaldependencies.org/treebanks/grc_proiel/index.html) corpora.
41
+
42
+ ### Installation
43
+
44
+ First install the python package as usual:
45
+
46
+ ``` bash
47
+ pip install -U grecy
48
+ ```
49
+
50
+ Once the package is successfully installed, you can proceed to install any of the followings models:
51
+
52
+ * grc_perseus_sm
53
+ * grc_proiel_sm
54
+ * grc_perseus_lg
55
+ * grc_proiel_lg
56
+ * grc_perseus_trf
57
+ * grc_proiel_trf
58
+
59
+
60
+ The models can be installed from the terminal with the commands below:
61
+
62
+ ```
63
+ python -m grecy install MODEL
64
+ ```
65
+ 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.
66
+
67
+
68
+ ### Loading
69
+
70
+ As usual, you can load any of the six models with the following Python lines:
71
+
72
+ ```
73
+ import spacy
74
+ nlp = spacy.load("grc_proiel_XX")
75
+ ```
76
+ 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.
77
+
78
+ ### Use
79
+
80
+ 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:
81
+
82
+ ```
83
+ import spacy
84
+ nlp = spacy.load("grc_proiel_trf")
85
+
86
+ text = "καὶ πρὶν μὲν ἐν κακοῖσι κειμένην ὅμως ἐλπίς μʼ ἀεὶ προσῆγε σωθέντος τέκνου ἀλκήν τινʼ εὑρεῖν κἀπικούρησιν δόμον"
87
+
88
+ doc = nlp(text)
89
+
90
+ for token in doc:
91
+ print(f'{token.text}, lemma: {token.lemma_} pos:{token.pos_}')
92
+
93
+ ```
94
+
95
+ #### The apostrophe issue
96
+
97
+ 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'.
98
+
99
+
100
+
101
+
102
+
103
+
104
+
105
+
106
+
107
+
108
+
@@ -0,0 +1,13 @@
1
+ LICENSE.txt
2
+ README.md
3
+ pyproject.toml
4
+ requirements.txt
5
+ grecy/__init__.py
6
+ grecy/__main__.py
7
+ grecy.egg-info/PKG-INFO
8
+ grecy.egg-info/SOURCES.txt
9
+ grecy.egg-info/dependency_links.txt
10
+ grecy.egg-info/requires.txt
11
+ grecy.egg-info/top_level.txt
12
+ grecy/utilities/__init__.py
13
+ grecy/utilities/connections.py
@@ -0,0 +1 @@
1
+ spacy<4.0.0,>=3.5
@@ -0,0 +1 @@
1
+ grecy
@@ -0,0 +1,28 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61.0"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "grecy"
7
+ version = "1.0"
8
+ description = "grecy installs six ancient Greek spaCy models that were trained using the Universal Dependency Proiel and Perseus treebanks."
9
+ readme = "README.md"
10
+ requires-python = ">=3.10"
11
+ license = {file = "LICENSE.txt"}
12
+ authors = [
13
+ { name="Jacobo Myerston", email="jmyerston@ucsd.edu" },
14
+ ]
15
+ classifiers = [
16
+ "Programming Language :: Python :: 3",
17
+ "License :: OSI Approved :: MIT License",
18
+ "Operating System :: OS Independent",
19
+ ]
20
+
21
+ dynamic = ["dependencies"]
22
+
23
+ [tool.setuptools.dynamic]
24
+ dependencies = {file = ["requirements.txt"]}
25
+
26
+ [project.urls]
27
+ "Homepage" = "https://github.com/jmyerston/greCy"
28
+ "Bug Tracker" = "https://github.com/jmyerston/greCy/issues"
@@ -0,0 +1 @@
1
+ spacy>=3.5,<4.0.0
grecy-1.0/setup.cfg ADDED
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+