brill-postagger 0.1.1__py3-none-any.whl

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.
@@ -0,0 +1,13 @@
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
12
+ Requires-Dist: nltk
13
+
@@ -0,0 +1,17 @@
1
+ brill_postaggers/__init__.py,sha256=0ZyNcYNYnD52ND53Mw266eNbH5D6RLuanh34MhVznRU,1041
2
+ brill_postaggers/ca_ancora-ud-brill.pkl,sha256=bNIvxc5qGwGbtKaC2h9KvlY7YJvlCmqesLHXKruRpVE,455670
3
+ brill_postaggers/da_ddt-ud-brill.pkl,sha256=jfBHIQ9HPZcOX3SBjMxPdC6Lky7E-Psu0EnDz_J__Js,199618
4
+ brill_postaggers/de_gsd-ud-brill.pkl,sha256=OrvzjQUCxJabiaoMImiTDJ9iKUL_yQbBpwEgDE1kIow,617411
5
+ brill_postaggers/en_ewt-ud-brill.pkl,sha256=w77qqvBO5ikmq4FyXZiuOFfUkjY_dm3IkyLnj3m7FCU,351010
6
+ brill_postaggers/es_ancora-ud-brill.pkl,sha256=Tq-u1KAYSb4FjXxcTO0ipRajmdoISPcV6lb_k-6LsBM,487110
7
+ brill_postaggers/eu_bdt-ud-brill.pkl,sha256=o4nz80P2avs9PqTCBxVSWZMPseihr2ay6W8bemdcQV4,210031
8
+ brill_postaggers/fr_gsd-ud-brill.pkl,sha256=7chlLTquLp3u81FXirmt9411jvgIMChW1a8SiCVuJNU,524861
9
+ brill_postaggers/gl_ctg-ud-brill.pkl,sha256=o2EaBNpNGk6TKSwBHExxvZQQOaIzh8e9RrwiVwAqBE4,110388
10
+ brill_postaggers/it_vit-ud-brill.pkl,sha256=LhIjvOTbBCk5R0AzJZv9cmStJ3bH9EO9NoAl6V94Ep0,334131
11
+ brill_postaggers/nl_alpino-ud-brill.pkl,sha256=rYGDVc3fRLO2qPdJ3zU_EWHryuYl715p0yuYqybnzGA,321092
12
+ brill_postaggers/pt_bosque-ud-brill.pkl,sha256=g1aND1pmE16mHrIxWlFyLaBzMq-8_rjP-pWmWfoHH20,332838
13
+ brill_postaggers/version.py,sha256=YO17Z54RmHA5oRw9Kj8GqtARGSultBm53Tz4k26JgYE,114
14
+ brill_postagger-0.1.1.dist-info/METADATA,sha256=UL35jXLlRDIhNMRv17V5OcU3619EAehT9pVmcp-mko0,420
15
+ brill_postagger-0.1.1.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
16
+ brill_postagger-0.1.1.dist-info/top_level.txt,sha256=AxlyH2Mx_X0YODSowoeZ7aAIMNt8d4p44jY7XKTnoh4,17
17
+ brill_postagger-0.1.1.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: bdist_wheel (0.45.1)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -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,6 @@
1
+ # START_VERSION_BLOCK
2
+ VERSION_MAJOR = 0
3
+ VERSION_MINOR = 1
4
+ VERSION_BUILD = 1
5
+ VERSION_ALPHA = 0
6
+ # END_VERSION_BLOCK