diff --git a/CHANGELOG.md b/CHANGELOG.md
index a36adb8..cd96692 100755
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,13 @@
# verbecc Changelog
+- 1.9.1 [17 December 2023]
+ - Renamed Catalan 'preterit' to 'passat-simple'
+ - Cont. added more missing conjugation templates for Catalan, decent support for most Catalan verbs now
+ - Added `localization` module with localization functions `localize_mood` and `localize_tense`
+ - Removed pre-generated model .zip files
+ - Added dummy file in models directory as workaround for installation issue
+ - fixed KeyError with Spanish verb abolir
+
- 1.9.0 [December 2023]
- Added limited support for Catalan language
- Please help improve support for Catalan verb conjugation, PRs welcome
@@ -8,7 +16,7 @@
- Updated dependencies (scikit-learn, etc.)
- Now targetting Python 3.11
-- 1.8.1 [2022 December 28]
+- 1.8.1 [28 December 2022]
- Updated from Python 3.7 to Python 3.10
- Updated dependencies
- Increased SGDClassifier max_iter from 4000 to 40000
diff --git a/EXAMPLE_CA_SER.md b/EXAMPLE_CA_SER.md
index 010a9b4..d753af9 100755
--- a/EXAMPLE_CA_SER.md
+++ b/EXAMPLE_CA_SER.md
@@ -32,7 +32,7 @@
"vosaltres éreu",
"ells eren"
],
- "pretèrit": [
+ "passat-simple": [
"jo fui",
"tu fores",
"ell fou",
diff --git a/README.md b/README.md
index d6a8ede..bd262f3 100755
--- a/README.md
+++ b/README.md
@@ -19,7 +19,7 @@
- [HTTP API : /verbecc/conjugate/fr/manger](http://verbe.cc/verbecc/conjugate/fr/manger)
### Features
-* Conjugate verbs in six romance languages: French, Spanish, Portuguese, Italian, Romanian, Catalan (limited-support)
+* Conjugate verbs in six romance languages: French, Spanish, Portuguese, Italian, Romanian, Catalan
* Uses machine learning techniques to predict conjugation of unknown verbs with 99% accurracy
* Includes both simple and compound conjugations
* Unit-tested
diff --git a/pyproject.toml b/pyproject.toml
index 7970ee7..96ac1be 100755
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
[project]
name = "verbecc"
-version = "1.9.0"
+version = "1.9.1"
dependencies = [
"lxml",
"lxml-stubs",
diff --git a/tests/test_inflector_ca.py b/tests/test_inflector_ca.py
index ba18047..e26eb40 100755
--- a/tests/test_inflector_ca.py
+++ b/tests/test_inflector_ca.py
@@ -8,6 +8,7 @@
cg = Conjugator(lang='ca')
+# TODO: Fix all of these missing templates
@pytest.mark.skip("known failure")
def test_all_verbs_have_templates():
"""Have not finished adding templates for all verbs, so this should fail"""
@@ -140,7 +141,11 @@ def test_find_verb_by_infinitive():
('morir', 'indicatiu', 'present',
['jo moro', 'tu mors', 'ell mor', 'nosaltres morim', 'vosaltres moriu', 'ells moren']),
('eixir', 'indicatiu', 'present',
- ['jo ixo', 'tu ixes', 'ell ix', 'nosaltres eixim', 'vosaltres eixiu', 'ells ixen'])
+ ['jo ixo', 'tu ixes', 'ell ix', 'nosaltres eixim', 'vosaltres eixiu', 'ells ixen']),
+ ('jaure', 'indicatiu', 'present',
+ ['jo jec', 'tu jeus', 'ell jeu', 'nosaltres jaiem', 'vosaltres jaieu', 'ells jeuen']),
+ ('jeure', 'indicatiu', 'present',
+ ['jo jec', 'tu jeus', 'ell jeu', 'nosaltres jaiem', 'vosaltres jaieu', 'ells jeuen'])
]
@pytest.mark.parametrize("infinitive,mood,tense,expected_result",
diff --git a/verbecc/data/conjugations-ca.xml b/verbecc/data/conjugations-ca.xml
index e376d3a..ac51300 100755
--- a/verbecc/data/conjugations-ca.xml
+++ b/verbecc/data/conjugations-ca.xml
@@ -634,6 +634,99 @@ voler ("to want"), caldre ("must"), dir ("to say") and dur ("to take/get").
+
+
+
+
+ ec
+ eus
+ eu
+ aiem
+ aieu
+ euen
+
+
+ eia
+ eies
+ eia
+ èiem
+ èieu
+ eien
+
+
+ aguí
+ agueres
+ agué
+ aguérem
+ aguéreu
+ aguéren
+
+
+ auré
+ auràs
+ aurà
+ aurem
+ aureu
+ auran
+
+
+
+
+ egui
+ eguis
+ egui
+ eguem
+ egueu
+ eguin
+
+
+ agués
+ aguessis
+ agués
+ aguéssim
+ aguéssiu
+ aguessin
+
+
+
+
+ ei
+ egui
+ eguem
+ aieu
+ eguin
+
+
+
+
+ auria
+ auries
+ auria
+ auríem
+ auríeu
+ aurien
+
+
+
+
+ eure
+
+
+
+
+ aient
+
+
+
+
+ agut
+ aguda
+ aguts
+ agudes
+
+
+
+
diff --git a/verbecc/data/verbs-ca.xml b/verbecc/data/verbs-ca.xml
index cf94456..f314721 100755
--- a/verbecc/data/verbs-ca.xml
+++ b/verbecc/data/verbs-ca.xml
@@ -5941,9 +5941,9 @@
jaspiarcanvi:ar
jaumetarcant:ar
jauparcant:ar
-jaure:perdre
+jaurej:aurelie down
jerarquitzarcant:ar
-jeure:jaure
+jeurej:aurelie
joguinejarenve:jar
jornalejarenve:jar
jovenejarenve:jar
diff --git a/verbecc/inflector.py b/verbecc/inflector.py
index abf392a..88679ee 100755
--- a/verbecc/inflector.py
+++ b/verbecc/inflector.py
@@ -6,7 +6,6 @@
from verbecc import grammar_defines
from verbecc import exceptions
-from verbecc import inflector
from verbecc import conjugations_parser
from verbecc import conjugation_template
from verbecc import verb
@@ -62,13 +61,17 @@ def find_verb_by_infinitive(self, infinitive) -> verb.Verb:
def find_template(self, name: str) -> conjugation_template.ConjugationTemplate:
return self._conj_parser.find_template(name)
- def get_verbs_that_start_with(self, query, max_results):
+ def get_verbs_that_start_with(self, query: str, max_results: int):
query = query.lower()
matches = self._verb_parser.get_verbs_that_start_with(query, max_results)
return matches
- def _get_verb_stem(self, infinitive, template_name):
- template_beg, template_ending = template_name.split(u':')
+ def _get_verb_stem(self, infinitive: str, template_name: str):
+ """Get the verb stem given an ininitive and a colon-delimited template name.
+ E.g. infinitive='parler' template_name='aim:er' -> 'parl'
+ Note: Catalan overrides this base class implementation to allow looser matching
+ (only requires the last n-1 chars of template ending to match infinitive ending)"""
+ _, template_ending = template_name.split(u':')
if not infinitive.endswith(template_ending):
raise exceptions.ConjugatorError(
"Template {} ending doesn't "
@@ -76,16 +79,16 @@ def _get_verb_stem(self, infinitive, template_name):
.format(template_name, infinitive))
return infinitive[:len(infinitive) - len(template_ending)]
- def _is_impersonal_verb(self, infinitive):
+ def _is_impersonal_verb(self, infinitive: str):
return False
- def _verb_can_be_reflexive(self, infinitive):
+ def _verb_can_be_reflexive(self, infinitive: str):
return not self._is_impersonal_verb(infinitive)
- def _split_reflexive(self, infinitive):
+ def _split_reflexive(self, infinitive: str):
return (False, infinitive)
- def _add_reflexive_pronoun(self, s):
+ def _add_reflexive_pronoun(self, s: str):
pass
def _add_subjunctive_relative_pronoun(self, s: str, tense_name: str):
diff --git a/verbecc/inflector_ca.py b/verbecc/inflector_ca.py
index 2211d6d..246c914 100755
--- a/verbecc/inflector_ca.py
+++ b/verbecc/inflector_ca.py
@@ -2,6 +2,7 @@
from typing import Dict, List, Tuple
+from verbecc import exceptions
from verbecc import inflector
class InflectorCa(inflector.Inflector):
@@ -67,6 +68,7 @@ def _get_alternate_hv_inflection(self, s: str) -> str:
def _get_compound_conjugations_aux_verb_map(self) -> Dict[str, Dict[str, Tuple[str, ...]]]:
"""
+ TODO: Implement all these compound tenses (Spanish compound tenses in this commment, for reference)
return {
'indicatiu': {
'pretèrit-perfet-compuest': ('indicatiu', 'present'),
@@ -85,3 +87,26 @@ def _get_compound_conjugations_aux_verb_map(self) -> Dict[str, Dict[str, Tuple[s
}
"""
return {}
+
+ def _get_verb_stem(self, infinitive: str, template_name: str):
+ """Get the verb stem given an ininitive and a colon-delimited template name.
+ E.g. infinitive='parlar' template_name='cant:ar' -> 'parl'
+
+ Note: Base class _get_verb_stem raises exception if template ending doesn't
+ match infinitive ending exactly but for Catalan, some verbs
+ have endings where at least the first letter doesn't match.
+
+ E.g. both 'jaure' and and 'jeure' are apparently conjugated
+ identically, so we want either one to use the 'j:aure' template.
+ So since this is Catalan, let it pass if the last n-1 letters of the
+ template ending match the infinitive ending
+ """
+ _, template_ending = template_name.split(u':')
+ if not infinitive.endswith(template_ending) \
+ and not infinitive.endswith(template_ending[1:]):
+ raise exceptions.ConjugatorError(
+ "Template {} ending doesn't "
+ "match infinitive {},"
+ "not even a little bit"
+ .format(template_name, infinitive))
+ return infinitive[:len(infinitive) - len(template_ending)]