wordkers 1.0.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.
- wordkers-1.0.0/LICENSE +21 -0
- wordkers-1.0.0/PKG-INFO +46 -0
- wordkers-1.0.0/README.md +27 -0
- wordkers-1.0.0/pyproject.toml +27 -0
- wordkers-1.0.0/setup.cfg +4 -0
- wordkers-1.0.0/wordkers.egg-info/PKG-INFO +46 -0
- wordkers-1.0.0/wordkers.egg-info/SOURCES.txt +8 -0
- wordkers-1.0.0/wordkers.egg-info/dependency_links.txt +1 -0
- wordkers-1.0.0/wordkers.egg-info/top_level.txt +1 -0
- wordkers-1.0.0/wordkers.py +88 -0
wordkers-1.0.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Wordkers
|
|
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.
|
wordkers-1.0.0/PKG-INFO
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: wordkers
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Cliente Python de la Wordkers API: PLN del español (silabeo, acentuación, género, flexión, lematización…). Algoritmos + lingüística.
|
|
5
|
+
Author: Wordkers
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://wordkers.es
|
|
8
|
+
Project-URL: Documentation, https://docs.dhabil.com
|
|
9
|
+
Keywords: spanish,espanol,nlp,linguistics,morphology,syllabification,api,wordkers
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
12
|
+
Classifier: Operating System :: OS Independent
|
|
13
|
+
Classifier: Topic :: Text Processing :: Linguistic
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Requires-Python: >=3.7
|
|
16
|
+
Description-Content-Type: text/markdown
|
|
17
|
+
License-File: LICENSE
|
|
18
|
+
Dynamic: license-file
|
|
19
|
+
|
|
20
|
+
# wordkers
|
|
21
|
+
|
|
22
|
+
Cliente Python de la **Wordkers API** — procesamiento del lenguaje **español** mediante endpoints
|
|
23
|
+
simples: silabeo, acentuación, género, flexión (femenino/plural…), lematización y más.
|
|
24
|
+
**Algoritmos + lingüística, frente a estadística + suposición.**
|
|
25
|
+
|
|
26
|
+
## Instalación
|
|
27
|
+
```bash
|
|
28
|
+
pip install wordkers
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Uso
|
|
32
|
+
```python
|
|
33
|
+
from wordkers import Wordkers
|
|
34
|
+
|
|
35
|
+
wk = Wordkers("TU_CLAVE") # tu API key de Wordkers
|
|
36
|
+
|
|
37
|
+
wk.silabear("murciélago") # {'silabas': 'mur=cié=la=go', 'n_silabas': 4, 'silaba_tonica': 3}
|
|
38
|
+
wk.feminizar("bueno", categoria="Adjetivos") # {'femenino': 'buena', ...}
|
|
39
|
+
wk.pluralizar("luz") # {'plural': 'luces', ...}
|
|
40
|
+
wk.es_invariable("cantante") # True
|
|
41
|
+
wk.acentuar("cancion") # {'acentuada': ...}
|
|
42
|
+
wk.masculinizar("reina") # {'masculino': 'rey', ...}
|
|
43
|
+
wk.singularizar("luces") # {'opciones': ['luces', 'luce', 'luz'], ...}
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Sin dependencias (solo la librería estándar). Documentación: https://docs.dhabil.com
|
wordkers-1.0.0/README.md
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# wordkers
|
|
2
|
+
|
|
3
|
+
Cliente Python de la **Wordkers API** — procesamiento del lenguaje **español** mediante endpoints
|
|
4
|
+
simples: silabeo, acentuación, género, flexión (femenino/plural…), lematización y más.
|
|
5
|
+
**Algoritmos + lingüística, frente a estadística + suposición.**
|
|
6
|
+
|
|
7
|
+
## Instalación
|
|
8
|
+
```bash
|
|
9
|
+
pip install wordkers
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## Uso
|
|
13
|
+
```python
|
|
14
|
+
from wordkers import Wordkers
|
|
15
|
+
|
|
16
|
+
wk = Wordkers("TU_CLAVE") # tu API key de Wordkers
|
|
17
|
+
|
|
18
|
+
wk.silabear("murciélago") # {'silabas': 'mur=cié=la=go', 'n_silabas': 4, 'silaba_tonica': 3}
|
|
19
|
+
wk.feminizar("bueno", categoria="Adjetivos") # {'femenino': 'buena', ...}
|
|
20
|
+
wk.pluralizar("luz") # {'plural': 'luces', ...}
|
|
21
|
+
wk.es_invariable("cantante") # True
|
|
22
|
+
wk.acentuar("cancion") # {'acentuada': ...}
|
|
23
|
+
wk.masculinizar("reina") # {'masculino': 'rey', ...}
|
|
24
|
+
wk.singularizar("luces") # {'opciones': ['luces', 'luce', 'luz'], ...}
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Sin dependencias (solo la librería estándar). Documentación: https://docs.dhabil.com
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61.0"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "wordkers"
|
|
7
|
+
version = "1.0.0"
|
|
8
|
+
description = "Cliente Python de la Wordkers API: PLN del español (silabeo, acentuación, género, flexión, lematización…). Algoritmos + lingüística."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.7"
|
|
11
|
+
license = { text = "MIT" }
|
|
12
|
+
authors = [{ name = "Wordkers" }]
|
|
13
|
+
keywords = ["spanish", "espanol", "nlp", "linguistics", "morphology", "syllabification", "api", "wordkers"]
|
|
14
|
+
classifiers = [
|
|
15
|
+
"Programming Language :: Python :: 3",
|
|
16
|
+
"License :: OSI Approved :: MIT License",
|
|
17
|
+
"Operating System :: OS Independent",
|
|
18
|
+
"Topic :: Text Processing :: Linguistic",
|
|
19
|
+
"Intended Audience :: Developers",
|
|
20
|
+
]
|
|
21
|
+
|
|
22
|
+
[project.urls]
|
|
23
|
+
Homepage = "https://wordkers.es"
|
|
24
|
+
Documentation = "https://docs.dhabil.com"
|
|
25
|
+
|
|
26
|
+
[tool.setuptools]
|
|
27
|
+
py-modules = ["wordkers"]
|
wordkers-1.0.0/setup.cfg
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: wordkers
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Cliente Python de la Wordkers API: PLN del español (silabeo, acentuación, género, flexión, lematización…). Algoritmos + lingüística.
|
|
5
|
+
Author: Wordkers
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://wordkers.es
|
|
8
|
+
Project-URL: Documentation, https://docs.dhabil.com
|
|
9
|
+
Keywords: spanish,espanol,nlp,linguistics,morphology,syllabification,api,wordkers
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
12
|
+
Classifier: Operating System :: OS Independent
|
|
13
|
+
Classifier: Topic :: Text Processing :: Linguistic
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Requires-Python: >=3.7
|
|
16
|
+
Description-Content-Type: text/markdown
|
|
17
|
+
License-File: LICENSE
|
|
18
|
+
Dynamic: license-file
|
|
19
|
+
|
|
20
|
+
# wordkers
|
|
21
|
+
|
|
22
|
+
Cliente Python de la **Wordkers API** — procesamiento del lenguaje **español** mediante endpoints
|
|
23
|
+
simples: silabeo, acentuación, género, flexión (femenino/plural…), lematización y más.
|
|
24
|
+
**Algoritmos + lingüística, frente a estadística + suposición.**
|
|
25
|
+
|
|
26
|
+
## Instalación
|
|
27
|
+
```bash
|
|
28
|
+
pip install wordkers
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Uso
|
|
32
|
+
```python
|
|
33
|
+
from wordkers import Wordkers
|
|
34
|
+
|
|
35
|
+
wk = Wordkers("TU_CLAVE") # tu API key de Wordkers
|
|
36
|
+
|
|
37
|
+
wk.silabear("murciélago") # {'silabas': 'mur=cié=la=go', 'n_silabas': 4, 'silaba_tonica': 3}
|
|
38
|
+
wk.feminizar("bueno", categoria="Adjetivos") # {'femenino': 'buena', ...}
|
|
39
|
+
wk.pluralizar("luz") # {'plural': 'luces', ...}
|
|
40
|
+
wk.es_invariable("cantante") # True
|
|
41
|
+
wk.acentuar("cancion") # {'acentuada': ...}
|
|
42
|
+
wk.masculinizar("reina") # {'masculino': 'rey', ...}
|
|
43
|
+
wk.singularizar("luces") # {'opciones': ['luces', 'luce', 'luz'], ...}
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Sin dependencias (solo la librería estándar). Documentación: https://docs.dhabil.com
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
wordkers
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
"""
|
|
3
|
+
wordkers — cliente Python de la API de Wordkers (PLN del español).
|
|
4
|
+
|
|
5
|
+
Sin dependencias (solo librería estándar). Uso:
|
|
6
|
+
|
|
7
|
+
from wordkers import Wordkers
|
|
8
|
+
wk = Wordkers("TU_CLAVE")
|
|
9
|
+
wk.silabear("murciélago") # {'silabas': 'mur=cié=la=go', ...}
|
|
10
|
+
wk.feminizar("bueno", categoria="Adjetivos") # {'femenino': 'buena', ...}
|
|
11
|
+
wk.es_invariable("cantante") # True
|
|
12
|
+
"""
|
|
13
|
+
import json
|
|
14
|
+
import urllib.parse
|
|
15
|
+
import urllib.request
|
|
16
|
+
import urllib.error
|
|
17
|
+
|
|
18
|
+
__version__ = "1.0.0"
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class WordkersError(Exception):
|
|
22
|
+
"""Error de la API (clave inválida, rate-limit, parámetro, etc.)."""
|
|
23
|
+
def __init__(self, status, message):
|
|
24
|
+
self.status = status
|
|
25
|
+
super().__init__(f"[{status}] {message}")
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
class Wordkers:
|
|
29
|
+
def __init__(self, api_key, base_url="https://api.dhabil.com", timeout=15):
|
|
30
|
+
self.api_key = api_key
|
|
31
|
+
self.base_url = base_url.rstrip("/")
|
|
32
|
+
self.timeout = timeout
|
|
33
|
+
|
|
34
|
+
def _get(self, path, **params):
|
|
35
|
+
params = {k: v for k, v in params.items() if v is not None}
|
|
36
|
+
url = f"{self.base_url}{path}?{urllib.parse.urlencode(params)}"
|
|
37
|
+
req = urllib.request.Request(url, headers={
|
|
38
|
+
"X-API-Key": self.api_key,
|
|
39
|
+
"User-Agent": f"wordkers-python/{__version__}",
|
|
40
|
+
"Accept": "application/json",
|
|
41
|
+
})
|
|
42
|
+
try:
|
|
43
|
+
with urllib.request.urlopen(req, timeout=self.timeout) as r:
|
|
44
|
+
return json.loads(r.read().decode("utf-8"))
|
|
45
|
+
except urllib.error.HTTPError as e:
|
|
46
|
+
if e.code == 401:
|
|
47
|
+
raise WordkersError(401, "Clave de API ausente o inválida.")
|
|
48
|
+
if e.code == 429:
|
|
49
|
+
raise WordkersError(429, "Límite de llamadas superado. Reintenta más tarde.")
|
|
50
|
+
raise WordkersError(e.code, e.read().decode("utf-8", "replace"))
|
|
51
|
+
|
|
52
|
+
# --- silabeo y acento ---
|
|
53
|
+
def silabear(self, palabra):
|
|
54
|
+
return self._get("/v1/silabear", palabra=palabra)
|
|
55
|
+
|
|
56
|
+
def acentuar(self, palabra):
|
|
57
|
+
return self._get("/v1/acentuar", palabra=palabra)
|
|
58
|
+
|
|
59
|
+
# --- género ---
|
|
60
|
+
def genero(self, palabra):
|
|
61
|
+
return self._get("/v1/genero", palabra=palabra)
|
|
62
|
+
|
|
63
|
+
def es_invariable(self, palabra):
|
|
64
|
+
return self._get("/v1/es_invariable", palabra=palabra)["es_invariable"]
|
|
65
|
+
|
|
66
|
+
# --- flexión ---
|
|
67
|
+
def feminizar(self, palabra, categoria=None, singular=True):
|
|
68
|
+
return self._get("/v1/feminizar", palabra=palabra, categoria=categoria,
|
|
69
|
+
singular=str(singular).lower())
|
|
70
|
+
|
|
71
|
+
def masculinizar(self, palabra, categoria=None, singular=True):
|
|
72
|
+
return self._get("/v1/masculinizar", palabra=palabra, categoria=categoria,
|
|
73
|
+
singular=str(singular).lower())
|
|
74
|
+
|
|
75
|
+
def pluralizar(self, palabra):
|
|
76
|
+
return self._get("/v1/pluralizar", palabra=palabra)
|
|
77
|
+
|
|
78
|
+
def singularizar(self, palabra):
|
|
79
|
+
return self._get("/v1/singularizar", palabra=palabra)
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
if __name__ == "__main__":
|
|
83
|
+
import os
|
|
84
|
+
wk = Wordkers(os.environ.get("WORDKERS_KEY", ""))
|
|
85
|
+
print("silabear:", wk.silabear("murciélago"))
|
|
86
|
+
print("feminizar:", wk.feminizar("bueno", categoria="Adjetivos"))
|
|
87
|
+
print("es_invariable(cantante):", wk.es_invariable("cantante"))
|
|
88
|
+
print("pluralizar(luz):", wk.pluralizar("luz"))
|