Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -207,3 +207,4 @@ __marimo__/
**/simulation_*/
**/results/
exploratory_experiments/generated/
.idea/
8 changes: 4 additions & 4 deletions tests/test_adoption.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
)
from core.forms.morphology import Morphology
from core.phonology.phonrules import Cascade
from core.forms.utils import stem_and_suffix, make_form
from core.forms.utils import stem_and_affix, make_form


# ----------------- minimal helpers/fixtures -----------------
Expand Down Expand Up @@ -47,7 +47,7 @@ def small_morph() -> Morphology:

def alt_form(form: str) -> str:
"""Change the stem but keep the suffix."""
base, suf = stem_and_suffix(form)
base, suf = stem_and_affix(form)
return make_form(base + "_alt", suf)


Expand Down Expand Up @@ -129,11 +129,11 @@ def test_bernoulli_stem_form_is_target_updates_row(self) -> None:
self.assertTrue(changed)

# All slots for this lexeme should share the new stem
base_new, _ = stem_and_suffix(candidate)
base_new, _ = stem_and_affix(candidate)
stem = morph.stem_list[stem_id]
row_forms = morph.word_forms[stem].forms
for f in row_forms:
b, _ = stem_and_suffix(f)
b, _ = stem_and_affix(f)
self.assertEqual(b, base_new)

# ---------- DegreeAdoption ----------
Expand Down
2 changes: 1 addition & 1 deletion tests/test_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def make_small_morph() -> morph.Morphology:


def split_form(form: str) -> Tuple[str, str]:
base, suf = morph.stem_and_suffix(form)
base, suf = morph.stem_and_affix(form)
return base, suf


Expand Down
4 changes: 2 additions & 2 deletions tests/test_compression.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def set_row_signature_by_mutating(
We map index 0 -> original base, 1 -> base_x, 2 -> base_y, etc.
"""
# Build base strings per index
base0, _ = morph.stem_and_suffix(m.get_form(row, 0))
base0, _ = morph.stem_and_affix(m.get_form(row, 0))
base_for: Dict[int, str] = {0: base0}
# Pre-compute distinct alt bases we may need
for idx in set(signature):
Expand All @@ -45,7 +45,7 @@ def set_row_signature_by_mutating(

# Rewrite each slot with desired base + original suffix
for s, idx in enumerate(signature):
_, suf = morph.stem_and_suffix(m.get_form(row, s))
_, suf = morph.stem_and_affix(m.get_form(row, s))
print(suf)
new_form = morph.make_form(base_for[idx], suf)
m.set_form(row, s, new_form)
Expand Down
4 changes: 2 additions & 2 deletions tests/test_induction.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@ def set_row_signature_by_mutating(
m: morph.Morphology, row: int, signature: Tuple[int, ...]
) -> None:
"""Force a row's stem-alternation signature by rewriting bases slot-wise."""
base0, _ = morph.stem_and_suffix(m.get_form(row, 0))
base0, _ = morph.stem_and_affix(m.get_form(row, 0))
base_for: Dict[int, str] = {0: base0}
for idx in set(signature):
if idx == 0:
continue
base_for[idx] = f"{base0}_alt{idx}"

for s, idx in enumerate(signature):
_, suf = morph.stem_and_suffix(m.get_form(row, s))
_, suf = morph.stem_and_affix(m.get_form(row, s))
new_form = morph.make_form(base_for[idx], suf)
m.set_form(row, s, new_form)

Expand Down