/** Test of percentUnigramsInLM method, of class BaselineFeatures. */ @Test public void testPercentUnigramsInLM() { System.out.println("percentUnigramsInLM"); Configurator.setConfig( "eu.monnetproject.translation.langmodel", "ms", "src/test/resources/model.lm"); Translation translation = new MockTranslation("A B C E", "1 2 3"); double expResult = 1.0; double result = instance.percentUnigramsInLM(translation); assertEquals(expResult, result, 0.0); }
@Override public TranslationSource getSource(Language srcLang, Language trgLang) { final Properties config = Configurator.getConfig("eu.monnetproject.translation.sources.freetranslation"); if (!config.isEmpty()) { return new FreeTranslationSource(srcLang, trgLang, config); } else { return null; } }
/** Test of percentNGramsInTopBotQuartile method, of class BaselineFeatures. */ @Test public void testPercentNGramsInTopBotQuartile() { System.out.println("percentNGramsInTopBotQuartile"); Configurator.setConfig( "eu.monnetproject.translation.langmodel", "ms", "src/test/resources/model.lm"); Translation translation = new MockTranslation("A B C", "1 2 3"); int n = 1; double[] expResult = new double[] {1.0, 0.0}; double[] result = instance.percentNGramsInTopBotQuartile(translation, n); assertArrayEquals(expResult, result, 0.0); }