@Ignore @Test @Override public void testExactPlaceWordSpotting() throws MalformedURLException { // given URL aWavUrl = getWavFile().toURI().toURL(); Collection<Marker> keywordMarkers = findKeywordSegment(SEARCH_KEY_WORD, getWavFile(), KEY_WORD_SEQUENCE_ARR); SignalSegment keySegment = new SignalSegment(keywordMarkers.iterator().next()); getSpottingService().setDelta(1); getSpottingService().addKeySegment(keySegment); AcceptableSyllableThresholdDaoImpl acceptableSyllableThresholdDaoImpl = new AcceptableSyllableThresholdDaoImpl(); Map<String, Double> test = acceptableSyllableThresholdDaoImpl.read(getRepositoryPath().getAbsolutePath(), "word"); Double keyword_threshold = test.get(SEARCH_KEY_WORD); // when IExtractorInputReader reader = getSpottingService().createReader(aWavUrl); SignalSegment recalculatedFeatures = getSpottingService().recalculateFeatures(reader, keySegment.getMarker()); List<RecognitionResult> matchedResults = getSpottingService().match(recalculatedFeatures); // then assertNotNull(matchedResults); assertTrue("Results", matchedResults.size() > 1); RecognitionResult matched = matchedResults.get(0); assertEquals("Results", SEARCH_KEY_WORD, matched.getInfo().getName()); assertEquals( "Results", keyword_threshold, matched.getDetails().getDistances().get(ExtractorEnum.MFCC_EXTRACTOR.name()), keyword_threshold); }
@Ignore @Test @Override public void testWordSpotting() throws MalformedURLException { // given URL aWavUrl = getWavFile().toURI().toURL(); Collection<Marker> markers = findKeywordSegment(SEARCH_KEY_WORD, getWavFile(), KEY_WORD_SEQUENCE_ARR); SignalSegment keySegment = new SignalSegment(markers.iterator().next()); getSpottingService().addKeySegment(keySegment); final List<SignalSegment> foundSegments = Lists.newArrayList(); // when getSpottingService() .wordSpotting( aWavUrl, new SpottingListener() { @Override public String foundSegment( String sourceId, SignalSegment newSegment, List<RecognitionResult> recognitionResults) { foundSegments.add(newSegment); return newSegment.getMarker().getLabel(); } }); // then assertEquals("foundSegments", 2, foundSegments.size(), 0); SignalSegment foundSegment = foundSegments.get(0); assertEquals("Results", SEARCH_KEY_WORD, foundSegment.getMarker().getLabel()); assertNotNull("Keyword not found", foundSegment); assertNotNull("Keyword not found", foundSegment.getMarker()); assertNotNull("Keyword not found", foundSegment.getMarker().getStart()); assertEquals( "start of found key marker same as matched", getSpottingService().getKeySegmentList().get(0).getMarker().getStart(), foundSegment.getMarker().getStart(), 220L); }