Bläddra i källkod

test: [WFE] functional test of no matching words

To check we do not match any words that are not present in a media file with
speech, we use the English-language Harvard sentences for audio, and compare to
the classic French pangram: "Portez ce vieux whisky au juge blond qui fume" [1]
and ensure no Features are produced

[1]: "Take this old whisky to the blond judge who is smoking"
main
Rob Hallam 1 månad sedan
förälder
incheckning
1078318f2a
1 ändrade filer med 24 tillägg och 0 borttagningar
  1. +24
    -0
      test/test_feature_extractors_functional.py

+ 24
- 0
test/test_feature_extractors_functional.py Visa fil

@@ -254,5 +254,29 @@ class TestWordFEFunctional(FEFunctionalTest):
with self.assertRaises(RuntimeError):
testfe.run()

def test_audio_word_detection_harvard_no_matching_words(self):
"""Test audio word detection feature extractor
Uses:
- sample-manual-audio-harvardsentences-video-colours.mp4
:: Harvard sentences (list 1) up to item 1.8 ("The birch canoe... The hogs were fed")
plus the sentence: "Portez ce vieux whisky au juge blond qui fume"
-- pass if no features extracted
"""

SAMPLE_VIDEO = f"{self.SAMPLE_DIR}/sample-manual-audio-harvardsentences-video-colours.mp4"
DETECT_WORDS = "Portez ce vieux whisky au juge blond qui fume".split()

# create mock source with the video
source = mocks.MockSource(path=SAMPLE_VIDEO)

# create the feature extractor
testfe = extractors.WordFeatureExtractor(input_files=[source])
testfe.setup(words=DETECT_WORDS)
testfe.run()
testfe.teardown()

# ensure no Features:
self.assertEqual(len(testfe.features), 0)

if __name__ == "__main__":
unittest.main()

Laddar…
Avbryt
Spara