brill-postagger 0.1.1__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.
- brill_postagger-0.1.1/PKG-INFO +11 -0
- brill_postagger-0.1.1/README.md +54 -0
- brill_postagger-0.1.1/brill_postagger.egg-info/PKG-INFO +11 -0
- brill_postagger-0.1.1/brill_postagger.egg-info/SOURCES.txt +20 -0
- brill_postagger-0.1.1/brill_postagger.egg-info/dependency_links.txt +1 -0
- brill_postagger-0.1.1/brill_postagger.egg-info/requires.txt +1 -0
- brill_postagger-0.1.1/brill_postagger.egg-info/top_level.txt +1 -0
- brill_postagger-0.1.1/brill_postaggers/__init__.py +37 -0
- brill_postagger-0.1.1/brill_postaggers/ca_ancora-ud-brill.pkl +0 -0
- brill_postagger-0.1.1/brill_postaggers/da_ddt-ud-brill.pkl +0 -0
- brill_postagger-0.1.1/brill_postaggers/de_gsd-ud-brill.pkl +0 -0
- brill_postagger-0.1.1/brill_postaggers/en_ewt-ud-brill.pkl +0 -0
- brill_postagger-0.1.1/brill_postaggers/es_ancora-ud-brill.pkl +0 -0
- brill_postagger-0.1.1/brill_postaggers/eu_bdt-ud-brill.pkl +0 -0
- brill_postagger-0.1.1/brill_postaggers/fr_gsd-ud-brill.pkl +0 -0
- brill_postagger-0.1.1/brill_postaggers/gl_ctg-ud-brill.pkl +0 -0
- brill_postagger-0.1.1/brill_postaggers/it_vit-ud-brill.pkl +0 -0
- brill_postagger-0.1.1/brill_postaggers/nl_alpino-ud-brill.pkl +0 -0
- brill_postagger-0.1.1/brill_postaggers/pt_bosque-ud-brill.pkl +0 -0
- brill_postagger-0.1.1/brill_postaggers/version.py +6 -0
- brill_postagger-0.1.1/setup.cfg +4 -0
- brill_postagger-0.1.1/setup.py +68 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: brill_postagger
|
|
3
|
+
Version: 0.1.1
|
|
4
|
+
Summary: Brill Postagger for various languages using NLTK
|
|
5
|
+
Home-page: https://github.com/TigreGotico/brill_postaggers
|
|
6
|
+
Author: JarbasAi
|
|
7
|
+
Author-email: jarbasai@mailfence.com
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
10
|
+
Classifier: Operating System :: OS Independent
|
|
11
|
+
Requires-Python: >=3.9
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# Brill Postagger
|
|
2
|
+
|
|
3
|
+
A Python package that uses the Brill Tagging algorithm for part-of-speech tagging, available for several languages. It utilizes the NLTK library for tokenization and tagging.
|
|
4
|
+
|
|
5
|
+
Models have been trained with [UniversalDependencies](https://github.com/UniversalDependencies) datasets
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
To install the package, you can use pip:
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
pip install brill_postagger
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Usage
|
|
16
|
+
|
|
17
|
+
To use the Brill Postagger, first download the corresponding pre-trained model, then use it to tag sentences in various languages.
|
|
18
|
+
|
|
19
|
+
Example usage:
|
|
20
|
+
|
|
21
|
+
```python
|
|
22
|
+
from brill_postagger import BrillPostagger
|
|
23
|
+
|
|
24
|
+
# Initialize the tagger for Portuguese (pt)
|
|
25
|
+
tagger = BrillPostagger.from_pretrained("pt")
|
|
26
|
+
|
|
27
|
+
# Tag a sentence
|
|
28
|
+
result = tagger.tag("como está o tempo lá fora?")
|
|
29
|
+
print(result)
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### Supported Languages
|
|
33
|
+
|
|
34
|
+
The following languages are supported, each corresponding to a pre-trained model:
|
|
35
|
+
|
|
36
|
+
- Catalan (`ca`)
|
|
37
|
+
- Danish (`da`)
|
|
38
|
+
- German (`de`)
|
|
39
|
+
- English (`en`)
|
|
40
|
+
- Spanish (`es`)
|
|
41
|
+
- Basque (`eu`)
|
|
42
|
+
- French (`fr`)
|
|
43
|
+
- Galician (`gl`)
|
|
44
|
+
- Italian (`it`)
|
|
45
|
+
- Dutch (`nl`)
|
|
46
|
+
- Portuguese (`pt`)
|
|
47
|
+
|
|
48
|
+
### Contributing
|
|
49
|
+
|
|
50
|
+
If you'd like to contribute to the project, please feel free to submit issues or pull requests. Contributions are always welcome!
|
|
51
|
+
|
|
52
|
+
### License
|
|
53
|
+
|
|
54
|
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: brill-postagger
|
|
3
|
+
Version: 0.1.1
|
|
4
|
+
Summary: Brill Postagger for various languages using NLTK
|
|
5
|
+
Home-page: https://github.com/TigreGotico/brill_postaggers
|
|
6
|
+
Author: JarbasAi
|
|
7
|
+
Author-email: jarbasai@mailfence.com
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
10
|
+
Classifier: Operating System :: OS Independent
|
|
11
|
+
Requires-Python: >=3.9
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
README.md
|
|
2
|
+
setup.py
|
|
3
|
+
brill_postagger.egg-info/PKG-INFO
|
|
4
|
+
brill_postagger.egg-info/SOURCES.txt
|
|
5
|
+
brill_postagger.egg-info/dependency_links.txt
|
|
6
|
+
brill_postagger.egg-info/requires.txt
|
|
7
|
+
brill_postagger.egg-info/top_level.txt
|
|
8
|
+
brill_postaggers/__init__.py
|
|
9
|
+
brill_postaggers/ca_ancora-ud-brill.pkl
|
|
10
|
+
brill_postaggers/da_ddt-ud-brill.pkl
|
|
11
|
+
brill_postaggers/de_gsd-ud-brill.pkl
|
|
12
|
+
brill_postaggers/en_ewt-ud-brill.pkl
|
|
13
|
+
brill_postaggers/es_ancora-ud-brill.pkl
|
|
14
|
+
brill_postaggers/eu_bdt-ud-brill.pkl
|
|
15
|
+
brill_postaggers/fr_gsd-ud-brill.pkl
|
|
16
|
+
brill_postaggers/gl_ctg-ud-brill.pkl
|
|
17
|
+
brill_postaggers/it_vit-ud-brill.pkl
|
|
18
|
+
brill_postaggers/nl_alpino-ud-brill.pkl
|
|
19
|
+
brill_postaggers/pt_bosque-ud-brill.pkl
|
|
20
|
+
brill_postaggers/version.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
nltk
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
brill_postaggers
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import os.path
|
|
2
|
+
import pickle
|
|
3
|
+
|
|
4
|
+
import nltk
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class BrillPostagger:
|
|
8
|
+
MODELS = {
|
|
9
|
+
"ca": "ca_ancora-ud-brill",
|
|
10
|
+
"da": "da_ddt-ud-brill",
|
|
11
|
+
"de": "de_gsd-ud-brill",
|
|
12
|
+
"en": "en_ewt-ud-brill",
|
|
13
|
+
"es": "es_ancora-ud-brill",
|
|
14
|
+
"eu": "eu_bdt-ud-brill",
|
|
15
|
+
"fr": "fr_gsd-ud-brill",
|
|
16
|
+
"gl": "gl_ctg-ud-brill",
|
|
17
|
+
"it": "it_vit-ud-brill",
|
|
18
|
+
"nl": "nl_alpino-ud-brill",
|
|
19
|
+
"pt": "pt_bosque-ud-brill"
|
|
20
|
+
}
|
|
21
|
+
def __init__(self, model: str):
|
|
22
|
+
with open(model, "rb") as f:
|
|
23
|
+
self.tagger = pickle.load(f)
|
|
24
|
+
|
|
25
|
+
@staticmethod
|
|
26
|
+
def from_pretrained(lang: str):
|
|
27
|
+
lang = lang.split("-")[0].lower()
|
|
28
|
+
model = BrillPostagger.MODELS[lang]
|
|
29
|
+
return BrillPostagger(f"{os.path.dirname(__file__)}/{model}.pkl")
|
|
30
|
+
|
|
31
|
+
def tag(self, sentence: str):
|
|
32
|
+
tokens = nltk.word_tokenize(sentence)
|
|
33
|
+
return self.tagger.tag(tokens)
|
|
34
|
+
|
|
35
|
+
if __name__ == "__main__":
|
|
36
|
+
tagger = BrillPostagger.from_pretrained("pt")
|
|
37
|
+
print(tagger.tag("como está o tempo lá fora?"))
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
from setuptools import setup, find_packages
|
|
2
|
+
from setuptools import setup, find_packages
|
|
3
|
+
|
|
4
|
+
import os
|
|
5
|
+
import os.path
|
|
6
|
+
|
|
7
|
+
from setuptools import setup
|
|
8
|
+
|
|
9
|
+
BASEDIR = os.path.abspath(os.path.dirname(__file__))
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def get_version():
|
|
13
|
+
version_file = os.path.join(BASEDIR, 'brill_postaggers', 'version.py')
|
|
14
|
+
major, minor, build, alpha = (None, None, None, None)
|
|
15
|
+
with open(version_file) as f:
|
|
16
|
+
for line in f:
|
|
17
|
+
if 'VERSION_MAJOR' in line:
|
|
18
|
+
major = line.split('=')[1].strip()
|
|
19
|
+
elif 'VERSION_MINOR' in line:
|
|
20
|
+
minor = line.split('=')[1].strip()
|
|
21
|
+
elif 'VERSION_BUILD' in line:
|
|
22
|
+
build = line.split('=')[1].strip()
|
|
23
|
+
elif 'VERSION_ALPHA' in line:
|
|
24
|
+
alpha = line.split('=')[1].strip()
|
|
25
|
+
|
|
26
|
+
if ((major and minor and build and alpha) or
|
|
27
|
+
'# END_VERSION_BLOCK' in line):
|
|
28
|
+
break
|
|
29
|
+
version = f"{major}.{minor}.{build}"
|
|
30
|
+
if int(alpha):
|
|
31
|
+
version += f"a{alpha}"
|
|
32
|
+
return version
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
with open(os.path.join(BASEDIR, "README.md"), "r") as f:
|
|
36
|
+
long_description = f.read()
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
def required(requirements_file):
|
|
40
|
+
""" Read requirements file and remove comments and empty lines. """
|
|
41
|
+
with open(os.path.join(BASEDIR, requirements_file), 'r') as f:
|
|
42
|
+
requirements = f.read().splitlines()
|
|
43
|
+
if 'MYCROFT_LOOSE_REQUIREMENTS' in os.environ:
|
|
44
|
+
print('USING LOOSE REQUIREMENTS!')
|
|
45
|
+
requirements = [r.replace('==', '>=') for r in requirements]
|
|
46
|
+
return [pkg for pkg in requirements
|
|
47
|
+
if pkg.strip() and not pkg.startswith("#")]
|
|
48
|
+
|
|
49
|
+
setup(
|
|
50
|
+
name="brill_postagger",
|
|
51
|
+
version=get_version(),
|
|
52
|
+
description="Brill Postagger for various languages using NLTK",
|
|
53
|
+
author="JarbasAi",
|
|
54
|
+
author_email="jarbasai@mailfence.com",
|
|
55
|
+
url="https://github.com/TigreGotico/brill_postaggers",
|
|
56
|
+
packages=find_packages(),
|
|
57
|
+
install_requires=required('requirements.txt'),
|
|
58
|
+
classifiers=[
|
|
59
|
+
'Programming Language :: Python :: 3',
|
|
60
|
+
'License :: OSI Approved :: MIT License',
|
|
61
|
+
'Operating System :: OS Independent',
|
|
62
|
+
],
|
|
63
|
+
python_requires='>=3.9',
|
|
64
|
+
include_package_data=True,
|
|
65
|
+
package_data={
|
|
66
|
+
'': ['*.pkl'], # Include your .pkl model files in the distribution
|
|
67
|
+
},
|
|
68
|
+
)
|