Skip to content

Commit

Permalink
test: test #89 with the input file in the issue itself
Browse files Browse the repository at this point in the history
  • Loading branch information
joanise committed Nov 9, 2021
1 parent 02c2ff2 commit 95c68ab
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 0 deletions.
29 changes: 29 additions & 0 deletions test/data/ej-fra-dna-silence.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?xml version='1.0' encoding='utf-8'?>
<TEI>
<!-- To exclude any element from alignment, add the do-not-align="true" attribute to
it, e.g., <p do-not-align="true">...</p>, or
<s>Some text <foo do-not-align="true">do not align this</foo> more text</s> -->
<text xml:lang="fra">
<body>
<div type="page">
<p>
<s><silence dur="1"/>Bonjour.</s>
<s>Je m'appelle Éric Joanis.</s>
<s>Je suis <silence dur="1.382s"></silence> programmeur au sein <silence dur="500ms"></silence> de l'équipe des technologies pour les langues autochtones au CNRC.</s>
</p>
</div>
<div type="page">
<anchor time="28.6s"/>
<p do-not-align="true">
<s>J'ai fait une bonne partie de ma carrière en traduction automatique statistique, mais maintenant cette approche est déclassée par l'apprentissage profond.</s>
<s>En ce moment je travaille à l'alignement du hansard du Nunavut pour produire un corpus bilingue anglais-inuktitut.</s>
<s>Ce corpus permettra d'entraîner la TA, neuronale ou statistique, ainsi que d'autres applications de traitement du langage naturel.</s>
</p>
<anchor time="50.2s"/>
<p>
<s>En parallèle, j'aide à écrire des tests pour rendre le ReadAlong-Studio plus robuste.</s>
</p>
</div>
</body>
</text>
</TEI>
24 changes: 24 additions & 0 deletions test/test_silence.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,30 @@ def test_silence_insertion_with_incomplete_align_output(self):
delta=50,
)

@expectedFailure
def test_dna_silence(self):
"""Run the problematic input file from issue #89"""

# Related to https://github.com/ReadAlongs/Studio/issues/89
# delete the @expectedFailure line above once #89 is fixed.

output = os.path.join(self.tempdir, "dna-silence")
results = self.runner.invoke(
align,
[
"-s",
"-C",
"-t",
"-l",
"fra",
os.path.join(self.data_dir, "ej-fra-dna-silence.xml"),
os.path.join(self.data_dir, "ej-fra.m4a"),
output,
],
)
self.assertEqual(results.exception, None)
self.assertEqual(results.exit_code, 0)

def test_bad_silence(self):
output = os.path.join(self.tempdir, "bad_silence")
# Run align from bad xml
Expand Down

0 comments on commit 95c68ab

Please sign in to comment.