Skip to content

Commit

Permalink
add from_flags function
Browse files Browse the repository at this point in the history
  • Loading branch information
NeoLegends committed Jun 27, 2024
1 parent 0496d33 commit 8bbc626
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions i6_models/parts/factored_hybrid/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,17 @@ class PhonemeStateClassV1(Enum):
def factor(self):
return self.value

@staticmethod
def from_flags(cls, use_word_end_classes: bool, use_boundary_classes: bool) -> "PhonemeStateClassV1":
assert not (use_word_end_classes and use_boundary_classes), "cannot use both classes"

if use_boundary_classes:
return cls.boundary
elif use_word_end_classes:
return cls.word_end
else:
return cls.none


def get_center_dim(
n_contexts: int,
Expand Down

0 comments on commit 8bbc626

Please sign in to comment.