Skip to content

Commit

Permalink
Merge pull request #214 from Forced-Alignment-and-Vowel-Extraction/dev
Browse files Browse the repository at this point in the history
v0.7.6
  • Loading branch information
JoFrhwld authored Nov 13, 2024
2 parents fe370b4 + 8eab9ee commit 4451f04
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 5 deletions.
10 changes: 6 additions & 4 deletions src/aligned_textgrid/sequences/sequences.py
Original file line number Diff line number Diff line change
Expand Up @@ -629,12 +629,14 @@ def fuse_leftwards(
fuser.super_instance.subset_list.remove(fusee)
else:
raise Exception("Cannot fuse leftwards at right edge")

return self

def fuse_rightward(self)->None:
self.fuse_rightwards()
def fuse_rightward(self, *args, **kwargs)->None:
self.fuse_rightwards(*args, **kwargs)

def fuse_leftward(self)->None:
self.fuse_leftwards()
def fuse_leftward(self, *args, **kwargs)->None:
self.fuse_leftwards(*args, **kwargs)

## Extensions and Saving
def set_feature(
Expand Down
27 changes: 26 additions & 1 deletion tests/test_sequences/test_sequences.py
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,32 @@ def __init__(
):
super().__init__(Interval)

Lower.set_superset_class(Upper)
Lower.set_superset_class(Upper)

def test_rightward_alias(self):
fuser = self.SampleClass(Interval(0,1,"one"))
fusee = self.SampleClass(Interval(1, 2, "two"))
fuser.set_fol(fusee)

try:
fuser.fuse_rightward(label_fun = lambda x, y: x + "." + y)
except:
assert False

assert fuser.label == "one.two"

def test_leftward_alias(self):
fusee = self.SampleClass(Interval(0,1,"one"))
fuser = self.SampleClass(Interval(1, 2, "two"))
fuser.set_prev(fusee)

try:
fuser.fuse_leftward(label_fun = lambda x, y: x + "." + y)
except:
assert False

assert fuser.label == "one.two"


def test_rightwards_simple(self):
fuser = self.SampleClass(Interval(0,1,"one"))
Expand Down

0 comments on commit 4451f04

Please sign in to comment.