@Test public void testProbingPredictLanguages() { LanguageDetectorME ld = new LanguageDetectorME(this.model); for (int i = 0; i < 10000; i += 1000) { StringBuilder sb = new StringBuilder(); for (int j = 0; j <= i; j++) { sb.append("estava em uma marcenaria na Rua Bruno "); } ProbingLanguageDetectionResult result = ld.probingPredictLanguages(sb.toString()); Assert.assertTrue(result.getLength() <= 600); Language[] languages = result.getLanguages(); Assert.assertEquals(4, languages.length); Assert.assertEquals("pob", languages[0].getLang()); Assert.assertEquals("ita", languages[1].getLang()); Assert.assertEquals("spa", languages[2].getLang()); Assert.assertEquals("fra", languages[3].getLang()); } }
public ProbingLanguageDetectionResult probingPredictLanguages(CharSequence content) { return probingPredictLanguages(content, LanguageDetectorConfig.DEFAULT_LANGUAGE_DETECTOR_CONFIG); }
LanguageDetectorME implements LanguageDetector { public ProbingLanguageDetectionResult probingPredictLanguages(CharSequence content) { return probingPredictLanguages(content, LanguageDetectorConfig.DEFAULT_LANGUAGE_DETECTOR_CONFIG); } }
LanguageDetectorME implements LanguageDetector { public ProbingLanguageDetectionResult probingPredictLanguages(CharSequence content) { return probingPredictLanguages(content, LanguageDetectorConfig.DEFAULT_LANGUAGE_DETECTOR_CONFIG); } LanguageDetectorME(LanguageDetectorModel model); }
LanguageDetectorME implements LanguageDetector { public ProbingLanguageDetectionResult probingPredictLanguages(CharSequence content) { return probingPredictLanguages(content, LanguageDetectorConfig.DEFAULT_LANGUAGE_DETECTOR_CONFIG); } LanguageDetectorME(LanguageDetectorModel model); @Override Language[] predictLanguages(CharSequence content); @Override Language predictLanguage(CharSequence content); @Override String[] getSupportedLanguages(); ProbingLanguageDetectionResult probingPredictLanguages(CharSequence content); ProbingLanguageDetectionResult probingPredictLanguages(CharSequence content,
                                                                LanguageDetectorConfig config); static LanguageDetectorModel train(ObjectStream<LanguageSample> samples,
                                            TrainingParameters mlParams,
                                            LanguageDetectorFactory factory); }
LanguageDetectorME implements LanguageDetector { public ProbingLanguageDetectionResult probingPredictLanguages(CharSequence content) { return probingPredictLanguages(content, LanguageDetectorConfig.DEFAULT_LANGUAGE_DETECTOR_CONFIG); } LanguageDetectorME(LanguageDetectorModel model); @Override Language[] predictLanguages(CharSequence content); @Override Language predictLanguage(CharSequence content); @Override String[] getSupportedLanguages(); ProbingLanguageDetectionResult probingPredictLanguages(CharSequence content); ProbingLanguageDetectionResult probingPredictLanguages(CharSequence content,
                                                                LanguageDetectorConfig config); static LanguageDetectorModel train(ObjectStream<LanguageSample> samples,
                                            TrainingParameters mlParams,
                                            LanguageDetectorFactory factory);  }