forked from marytts/marytts
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
85 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
voice-cmu-slt-hsmm/src/test/groovy/marytts/modules/PraatTextGridGeneratorIT.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
package marytts.modules | ||
|
||
import org.junit.* | ||
|
||
import groovy.util.logging.Log4j | ||
|
||
import marytts.LocalMaryInterface | ||
import marytts.datatypes.MaryDataType | ||
|
||
@Log4j | ||
class PraatTextGridGeneratorIT { | ||
|
||
def mary | ||
|
||
@Before | ||
void setUp() { | ||
mary = new LocalMaryInterface() | ||
mary.outputType = MaryDataType.PRAAT_TEXTGRID.name | ||
} | ||
|
||
@Test | ||
void checkBoundaryTimes() { | ||
def textGrid = mary.generateText('Foo, bar.\n\nBaz!') | ||
def xmin = 0 | ||
def xmax = 0 | ||
def newInterval = false | ||
textGrid.eachLine { line-> | ||
switch(line) { | ||
case ~/.*intervals \[\d\]:.*/: | ||
newInterval = true // begin interval block | ||
log.info "begin new interval block: $line" | ||
break | ||
case { line =~ /.*xmin =.*/ && newInterval }: | ||
xmin = Float.parseFloat(line.split().last()) | ||
log.info "xmin = $xmin" | ||
assert xmin == xmax: "interval xmin must be equal to previous interval's xmax" | ||
break | ||
case { line =~ /.*xmax =.*/ && newInterval }: | ||
xmax = Float.parseFloat(line.split().last()) | ||
log.info "xmax = $xmax" | ||
assert xmax > xmin: "interval xmax must be bigger than xmin" | ||
break | ||
case ~/.*text = .*/: | ||
newInterval = false // end interval block | ||
log.info "end new interval block: $line" | ||
break | ||
case ~/.*class = "IntervalTier".*/: | ||
// starting new tier; reset times | ||
xmin = 0 | ||
xmax = 0 | ||
break | ||
default: | ||
// ignore other lines | ||
break | ||
} | ||
} | ||
} | ||
} |