use of org.apache.stanbol.enhancer.engines.lucenefstlinking.FstLinkingEngine in project stanbol by apache.
the class FstLinkingEngineTest method testFstLinkingWithProperNouns.
@Test
public void testFstLinkingWithProperNouns() throws Exception {
Dictionary<String, Object> dict = new Hashtable<String, Object>();
dict.put(PROCESSED_LANGUAGES, Arrays.asList("en;lmmtip;uc=LINK;prob=0.75;pprob=0.75"));
dict.put(PROCESS_ONLY_PROPER_NOUNS_STATE, true);
TextProcessingConfig tpc = TextProcessingConfig.createInstance(dict);
EntityLinkerConfig elc = new EntityLinkerConfig();
// this is assumed by this test
elc.setMinFoundTokens(2);
elc.setRedirectProcessingMode(RedirectProcessingMode.FOLLOW);
FstLinkingEngine engine = new FstLinkingEngine("proper-noun-linking", LinkingModeEnum.LINKABLE_TOKEN, fstConfig, tpc, elc, null);
processConentItem(engine);
validateEnhancements(Arrays.asList("Chancellor", "Angela Merkel", "Greece", "Greeks", "Germany", "SPD"), Arrays.asList(DBPEDIA + "Christian_Democratic_Union_(Germany)", DBPEDIA + "Angela_Merkel", DBPEDIA + "Greece", DBPEDIA + "Germany", DBPEDIA + "Social_Democratic_Party_of_Germany"));
}
use of org.apache.stanbol.enhancer.engines.lucenefstlinking.FstLinkingEngine in project stanbol by apache.
the class FstLinkingEngineTest method testFstLinkingWithNouns.
@Test
public void testFstLinkingWithNouns() throws Exception {
Dictionary<String, Object> dict = new Hashtable<String, Object>();
dict.put(PROCESSED_LANGUAGES, Arrays.asList("en;lmmtip;uc=LINK;prob=0.75;pprob=0.75"));
dict.put(PROCESS_ONLY_PROPER_NOUNS_STATE, false);
TextProcessingConfig tpc = TextProcessingConfig.createInstance(dict);
EntityLinkerConfig elc = new EntityLinkerConfig();
// this is assumed by this test
elc.setMinFoundTokens(2);
elc.setRedirectProcessingMode(RedirectProcessingMode.FOLLOW);
FstLinkingEngine engine = new FstLinkingEngine("proper-noun-linking", LinkingModeEnum.LINKABLE_TOKEN, fstConfig, tpc, elc, null);
processConentItem(engine);
validateEnhancements(Arrays.asList("Chancellor", "Angela Merkel", "Greece", "Greeks", "Germany", "SPD", "change", "election", "party", "policy"), Arrays.asList(DBPEDIA + "Christian_Democratic_Union_(Germany)", DBPEDIA + "Angela_Merkel", DBPEDIA + "Greece", DBPEDIA + "Germany", DBPEDIA + "Social_Democratic_Party_of_Germany", DBPEDIA + "Chancellor", DBPEDIA + "Election", DBPEDIA + "Party", DBPEDIA + "Policy"));
}
Aggregations