Search in sources :

Example 1 with FstLinkingEngine

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"));
}
Also used : EntityLinkerConfig(org.apache.stanbol.enhancer.engines.entitylinking.config.EntityLinkerConfig) TextProcessingConfig(org.apache.stanbol.enhancer.engines.entitylinking.config.TextProcessingConfig) Hashtable(java.util.Hashtable) FstLinkingEngine(org.apache.stanbol.enhancer.engines.lucenefstlinking.FstLinkingEngine) Test(org.junit.Test)

Example 2 with FstLinkingEngine

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"));
}
Also used : EntityLinkerConfig(org.apache.stanbol.enhancer.engines.entitylinking.config.EntityLinkerConfig) TextProcessingConfig(org.apache.stanbol.enhancer.engines.entitylinking.config.TextProcessingConfig) Hashtable(java.util.Hashtable) FstLinkingEngine(org.apache.stanbol.enhancer.engines.lucenefstlinking.FstLinkingEngine) Test(org.junit.Test)

Aggregations

Hashtable (java.util.Hashtable)2 EntityLinkerConfig (org.apache.stanbol.enhancer.engines.entitylinking.config.EntityLinkerConfig)2 TextProcessingConfig (org.apache.stanbol.enhancer.engines.entitylinking.config.TextProcessingConfig)2 FstLinkingEngine (org.apache.stanbol.enhancer.engines.lucenefstlinking.FstLinkingEngine)2 Test (org.junit.Test)2