Skip to content

Commit 52211a6

Browse files
authored
Merge pull request #37 from bretttolbert/refactor
Refactoring contd.
2 parents a9660f2 + 2a34865 commit 52211a6

File tree

10 files changed

+77
-87
lines changed

10 files changed

+77
-87
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# verbecc Changelog
22

3+
- 1.11.7 [TBR]
4+
- Cont. refactoring
5+
36
- 1.11.6 [26 October 2025]
47
- Fixed Voseo conjugation for irregular verb `ser` for the subjuntivo (no vowel accents)
58
- Misc. cleanup

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "verbecc"
7-
version = "1.11.6"
7+
version = "1.11.7"
88
dependencies = [
99
"cython>=3.1.4",
1010
"importlib_resources==6.4.5 ; python_version < '3.13'",

verbecc/src/conjugator/conjugator.py

Lines changed: 59 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ def _conjugate_mood_tense(
238238
tense,
239239
aux_mood,
240240
aux_tense,
241-
self._inflector.auxilary_verb_uses_alternate_conjugation(tense),
241+
self._inflector.auxiliary_verb_uses_alternate_conjugation(tense),
242242
alternates_behavior,
243243
gender=gender,
244244
conjugate_pronouns=conjugate_pronouns,
@@ -342,7 +342,7 @@ def _conjugate_compound(
342342
.tense_templates[aux_tense]
343343
.person_endings
344344
]
345-
aux_verb = self._inflector.get_auxilary_verb(co, mood, tense)
345+
aux_verb = self._inflector.get_auxiliary_verb(co, mood, tense)
346346
aux_co = self._get_conj_obs(aux_verb)
347347
aux_tense_template = copy.deepcopy(
348348
aux_co.template.mood_templates[aux_mood].tense_templates[aux_tense]
@@ -428,7 +428,7 @@ def _conjugate_compound_primary_verb(
428428
ret: List[str] = []
429429

430430
p_conj = []
431-
# the Romanian indicativ viitor-1 uses the inifitive form instead of the participle
431+
# the Romanian indicativ viitor-1 uses the infinitive form instead of the participle
432432
if self._inflector.compound_primary_verb_conjugation_uses_infinitive(
433433
mood, tense
434434
):
@@ -448,7 +448,7 @@ def _conjugate_compound_primary_verb(
448448
# cast is safe since we're not using AlternatesBehavior.All
449449
p_conj = cast(List[str], p_conj)
450450

451-
if not self._inflector.is_auxilary_verb_inflected(aux_verb):
451+
if not self._inflector.is_auxiliary_verb_inflected(aux_verb):
452452
# participle is not inflected, e.g. French passé composé with avoir
453453
# where aux_verb = "avoir"
454454
# e.g. j'ai parlé, tu as parlé, il a parlé, nous avons parlé, vous avez parlé, ils ont parlé
@@ -573,30 +573,55 @@ def _conjugate_simple_mood_tense(
573573
"""
574574
if modify_stem_strip_accents and mood != self._inflector.get_infinitive_mood():
575575
verb_stem = strip_accents(verb_stem)
576-
ret = []
576+
ret: TenseConjugation = []
577577
tense = tense_template.name
578+
compound = True
578579
if (
579580
tense in self._inflector.get_tenses_conjugated_without_pronouns()
580581
or not conjugate_pronouns
581582
):
582-
for person_ending in tense_template.person_endings:
583-
person_ending = self._inflector.modify_person_ending_if_applicable(
584-
person_ending,
585-
mood,
586-
tense,
587-
tense_template,
588-
lang_specific_options,
589-
)
590-
person_conjugation: PersonConjugation = []
591-
endings: List[str] = []
592-
if alternates_behavior == AlternatesBehavior.FirstOnly:
593-
endings.append(person_ending.get_ending())
594-
elif alternates_behavior == AlternatesBehavior.SecondOnly:
595-
endings.append(person_ending.get_alternate_ending_if_available())
596-
else: # default: AlernatesBehavior.All
597-
endings.extend(person_ending.get_endings())
598-
# there may be one or more alternate endings
599-
for ending in endings:
583+
compound = False
584+
585+
for person_ending in tense_template.person_endings:
586+
person_ending = self._inflector.modify_person_ending_if_applicable(
587+
person_ending,
588+
mood,
589+
tense,
590+
tense_template,
591+
lang_specific_options,
592+
)
593+
# There will be at least one conjugation per person-ending and
594+
# potentially one or more alternate conjugations
595+
person_conjugation: PersonConjugation = []
596+
endings: List[str] = []
597+
if alternates_behavior == AlternatesBehavior.FirstOnly:
598+
endings.append(person_ending.get_ending())
599+
elif alternates_behavior == AlternatesBehavior.SecondOnly:
600+
endings.append(person_ending.get_alternate_ending_if_available())
601+
else: # default: AlternatesBehavior.All
602+
endings.extend(person_ending.get_endings())
603+
# there may be one or more alternate endings
604+
for ending in endings:
605+
if compound:
606+
# compound conjugation
607+
pronoun = self._inflector.get_default_pronoun(
608+
person=person_ending.get_person(),
609+
gender=gender,
610+
is_reflexive=is_reflexive,
611+
lang_specific_options=lang_specific_options,
612+
)
613+
s = "-"
614+
if ending != "-":
615+
conj = self._inflector.combine_verb_stem_and_ending(
616+
verb_stem, ending
617+
)
618+
s = self._inflector.combine_pronoun_and_conj(pronoun, conj)
619+
if mood == self._inflector.get_subjunctive_mood():
620+
s = self._inflector.add_subjunctive_relative_pronoun(
621+
s, tense
622+
)
623+
else:
624+
# simple conjugation
600625
s = self._inflector.add_present_participle_if_applicable(
601626
"", is_reflexive, tense
602627
)
@@ -616,53 +641,15 @@ def _conjugate_simple_mood_tense(
616641
)
617642
if ending != "-":
618643
s = self._inflector.add_adverb_if_applicable(s, mood, tense)
619-
person_conjugation.append(s)
620-
if alternates_behavior == AlternatesBehavior.All:
621-
ret.append(list(person_conjugation))
622-
elif (
623-
alternates_behavior == AlternatesBehavior.SecondOnly
624-
and len(person_conjugation) > 1
625-
):
626-
ret.append(person_conjugation[1])
627-
else:
628-
ret.append(person_conjugation[0])
629-
else:
630-
for person_ending in tense_template.person_endings:
631-
person_ending = self._inflector.modify_person_ending_if_applicable(
632-
person_ending,
633-
mood,
634-
tense,
635-
tense_template,
636-
lang_specific_options,
637-
)
638-
# There will be at least one conjugation per person-ending and
639-
# potentially one or more alternate conjugations
640-
person_conjugation: PersonConjugation = []
641-
for ending in person_ending.get_endings():
642-
pronoun = self._inflector.get_default_pronoun(
643-
person=person_ending.get_person(),
644-
gender=gender,
645-
is_reflexive=is_reflexive,
646-
lang_specific_options=lang_specific_options,
647-
)
648-
s = "-"
649-
if ending != "-":
650-
conj = self._inflector.combine_verb_stem_and_ending(
651-
verb_stem, ending
652-
)
653-
s = self._inflector.combine_pronoun_and_conj(pronoun, conj)
654-
if mood == self._inflector.get_subjunctive_mood():
655-
s = self._inflector.add_subjunctive_relative_pronoun(
656-
s, tense
657-
)
658-
person_conjugation.append(s)
659-
if alternates_behavior == AlternatesBehavior.All:
660-
ret.append(list(person_conjugation))
661-
elif (
662-
alternates_behavior == AlternatesBehavior.SecondOnly
663-
and len(person_conjugation) > 1
664-
):
665-
ret.append(person_conjugation[1])
666-
else:
667-
ret.append(person_conjugation[0])
644+
person_conjugation.append(s)
645+
if alternates_behavior == AlternatesBehavior.All:
646+
ret.append(list(person_conjugation))
647+
elif (
648+
alternates_behavior == AlternatesBehavior.SecondOnly
649+
and len(person_conjugation) > 1
650+
):
651+
ret.append(person_conjugation[1])
652+
else:
653+
ret.append(person_conjugation[0])
654+
668655
return ret

verbecc/src/inflectors/inflector.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,18 +118,18 @@ def add_reflexive_pronoun(self, s: str) -> str:
118118
def add_subjunctive_relative_pronoun(self, s: str, tense: Tense) -> str:
119119
return s
120120

121-
def auxilary_verb_uses_alternate_conjugation(self, tense: Tense) -> bool:
121+
def auxiliary_verb_uses_alternate_conjugation(self, tense: Tense) -> bool:
122122
return False
123123

124124
def get_tenses_conjugated_without_pronouns(self) -> List[str]:
125125
return []
126126

127-
def get_auxilary_verb(
127+
def get_auxiliary_verb(
128128
self, co: ConjugationObjects, mood: Mood, tense: Tense
129129
) -> str:
130130
return ""
131131

132-
def is_auxilary_verb_inflected(self, auxilary_verb: str) -> bool:
132+
def is_auxiliary_verb_inflected(self, auxiliary_verb: str) -> bool:
133133
return False
134134

135135
def get_infinitive_mood(self) -> Mood:

verbecc/src/inflectors/lang/inflector_ca.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ def get_tenses_conjugated_without_pronouns(self) -> List[Tense]:
7171
Tense.ImperatiuPresent,
7272
]
7373

74-
def get_auxilary_verb(
74+
def get_auxiliary_verb(
7575
self,
7676
co: ConjugationObjects,
7777
mood: Mood,

verbecc/src/inflectors/lang/inflector_es.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ def get_tenses_conjugated_without_pronouns(self) -> List[Tense]:
9090
Tense.Negativo,
9191
]
9292

93-
def get_auxilary_verb(
93+
def get_auxiliary_verb(
9494
self,
9595
co: ConjugationObjects,
9696
mood: Mood,

verbecc/src/inflectors/lang/inflector_fr.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ def get_tenses_conjugated_without_pronouns(self) -> List[Tense]:
149149
Tense.ParticipePassé,
150150
]
151151

152-
def get_auxilary_verb(
152+
def get_auxiliary_verb(
153153
self,
154154
co: ConjugationObjects,
155155
mood: Mood,
@@ -160,8 +160,8 @@ def get_auxilary_verb(
160160
ret = "être"
161161
return ret
162162

163-
def is_auxilary_verb_inflected(self, auxilary_verb: str) -> bool:
164-
return auxilary_verb == "être"
163+
def is_auxiliary_verb_inflected(self, auxiliary_verb: str) -> bool:
164+
return auxiliary_verb == "être"
165165

166166
def get_infinitive_mood(self) -> Mood:
167167
return Mood.Infinitif

verbecc/src/inflectors/lang/inflector_it.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ def __init__(self) -> None:
4040
def lang(self) -> LangCodeISO639_1:
4141
return LangCodeISO639_1.it
4242

43-
def is_auxilary_verb_inflected(self, auxilary_verb: str) -> bool:
44-
return auxilary_verb == "essere"
43+
def is_auxiliary_verb_inflected(self, auxiliary_verb: str) -> bool:
44+
return auxiliary_verb == "essere"
4545

4646
def split_reflexive(self, infinitive: str) -> Tuple[bool, str]:
4747
"""
@@ -120,7 +120,7 @@ def get_tenses_conjugated_without_pronouns(self) -> List[Tense]:
120120
Tense.ParticipioPassato,
121121
]
122122

123-
def get_auxilary_verb(
123+
def get_auxiliary_verb(
124124
self, co: ConjugationObjects, mood: Mood, tense: Tense
125125
) -> str:
126126
ret = "avere"

verbecc/src/inflectors/lang/inflector_pt.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ def get_tenses_conjugated_without_pronouns(self) -> List[Tense]:
103103
Tense.Gerúndio,
104104
]
105105

106-
def get_auxilary_verb(
106+
def get_auxiliary_verb(
107107
self,
108108
co: ConjugationObjects,
109109
mood: Mood,

verbecc/src/inflectors/lang/inflector_ro.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ def get_tenses_conjugated_without_pronouns(self) -> List[Tense]:
8484
Tense.Gerunziu,
8585
]
8686

87-
def get_auxilary_verb(
87+
def get_auxiliary_verb(
8888
self, co: ConjugationObjects, mood: Mood, tense: Tense
8989
) -> str:
9090
if tense in (Tense.Viitor1, Tense.Viitor2):
@@ -130,7 +130,7 @@ def get_compound_conjugations_aux_verb_map(
130130
},
131131
}
132132

133-
def auxilary_verb_uses_alternate_conjugation(self, tense: Tense) -> bool:
133+
def auxiliary_verb_uses_alternate_conjugation(self, tense: Tense) -> bool:
134134
return tense.startswith("viitor")
135135

136136
def compound_primary_verb_conjugation_uses_infinitive(

0 commit comments

Comments
 (0)