Skip to content

Commit

Permalink
Merge pull request #6 from Forced-Alignment-and-Vowel-Extraction/5-bu…
Browse files Browse the repository at this point in the history
…g-use-of-aligned_textgridinterleave_class-changes-changes-class-definition-causing-bugs-when-iterating

5 bug use of aligned textgridinterleave class changes changes class definition causing bugs when iterating
  • Loading branch information
JoFrhwld authored May 2, 2024
2 parents 9879c21 + a8c21e3 commit 2bcccf1
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 20 deletions.
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)

0 comments on commit 2bcccf1

Please sign in to comment.