Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

5 bug use of aligned textgridinterleave class changes changes class definition causing bugs when iterating #6

Merged
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
37 changes: 20 additions & 17 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ packages = [{include = "fave_syllabify", from = "src"}]

[tool.poetry.dependencies]
python = "^3.10"
aligned-textgrid = "^0.6.3"
aligned-textgrid = "^0.6.6"

[tool.poetry.group.dev.dependencies]
jupyter = "^1.0.0"
Expand Down
28 changes: 26 additions & 2 deletions tests/test_syllabify.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import pytest
from aligned_textgrid import AlignedTextGrid, custom_classes
from aligned_textgrid import AlignedTextGrid, custom_classes, Word, Phone
from fave_syllabify import syllabify_tg
from pathlib import Path

Expand Down Expand Up @@ -31,4 +31,28 @@ def test_syllabify():
for p in phones:
if len(syl.label)>0:
assert p.within.label in ["onset", "nucleus", "coda"]



def test_syllabify_iter():

tg_path = Path("tests", "data", "aligned", "words.TextGrid")

entry_classes = classes = custom_classes(["Word", "Phone"])

tg1 = AlignedTextGrid(
textgrid_path=tg_path,
entry_classes= entry_classes
)

tg2 = AlignedTextGrid(
textgrid_path=tg_path,
entry_classes= entry_classes
)

syllabify_tg(tg1)

assert entry_classes[0].subset_class is entry_classes[1]
assert not tg1[0].Word.subset_class is entry_classes[1]

syllabify_tg(tg2)

Loading