Package org.apache.stanbol.enhancer.engines.entitylinking.impl

Examples of org.apache.stanbol.enhancer.engines.entitylinking.impl.EntityLinker


        tpc.setLinkedLexicalCategories(LanguageProcessingConfig.DEFAULT_LINKED_LEXICAL_CATEGORIES);
        tpc.setLinkedPos(Collections.EMPTY_SET);
        EntityLinkerConfig config = new EntityLinkerConfig();
        config.setMinFoundTokens(2);//this is assumed by this test
        config.setRedirectProcessingMode(RedirectProcessingMode.FOLLOW);
        EntityLinker linker = new EntityLinker(TEST_ANALYSED_TEXT,"en",
            tpc, searcher, config, labelTokenizer);
        linker.process();
        Map<String,List<String>> expectedResults = new HashMap<String,List<String>>();
        expectedResults.put("Patrick Marshall", new ArrayList<String>(
                Arrays.asList("urn:test:PatrickMarshall")));
        expectedResults.put("geologist", new ArrayList<String>(
                Arrays.asList("urn:test:redirect:Geologist"))); //the redirected entity
View Full Code Here


        tpc.setLinkedPos(Collections.EMPTY_SET);
        tpc.setIgnoreChunksState(true); //to emulate pre STANBOL-1211
        EntityLinkerConfig config = new EntityLinkerConfig();
        config.setMinFoundTokens(2);//this is assumed by this test
        config.setRedirectProcessingMode(RedirectProcessingMode.FOLLOW);
        EntityLinker linker = new EntityLinker(TEST_ANALYSED_TEXT_WO,"en",
            tpc, searcher, config, labelTokenizer);
        linker.process();
        Map<String,List<String>> expectedResults = new HashMap<String,List<String>>();
        expectedResults.put("Marshall Patrick", new ArrayList<String>(
                Arrays.asList("urn:test:PatrickMarshall")));
        expectedResults.put("geologist", new ArrayList<String>(
                Arrays.asList("urn:test:redirect:Geologist"))); //the redirected entity
View Full Code Here

        tpc.setLinkedLexicalCategories(Collections.EMPTY_SET);
        tpc.setLinkedPos(LanguageProcessingConfig.DEFAULT_LINKED_POS);
        EntityLinkerConfig config = new EntityLinkerConfig();
        config.setMinFoundTokens(2);//this is assumed by this test
        config.setRedirectProcessingMode(RedirectProcessingMode.FOLLOW);
        EntityLinker linker = new EntityLinker(TEST_ANALYSED_TEXT,"en",
            tpc, searcher, config, labelTokenizer);
        linker.process();
        Map<String,List<String>> expectedResults = new HashMap<String,List<String>>();
        expectedResults.put("Patrick Marshall", new ArrayList<String>(
                Arrays.asList("urn:test:PatrickMarshall")));
        //Geologist is a common noun and MUST NOT be found
        //expectedResults.put("geologist", new ArrayList<String>(
View Full Code Here

            throw new IllegalStateException("The language '"+language+"' is not configured "
                    + "to be processed by this Engine. As this is already checked within the "
                    + "canEnhance(..) method this may indicate an bug in the used "
                    + "EnhanceemntJobManager implementation!");
        }
        EntityLinker entityLinker = new EntityLinker(at,language,
            languageConfig, entitySearcher, linkerConfig, labelTokenizer);
        //process
        try {
            entityLinker.process();
        } catch (EntitySearcherException e) {
            log.error("Unable to link Entities with "+entityLinker,e);
            throw new EngineException(this, ci, "Unable to link Entities with "+entityLinker, e);
        }
        if(log.isInfoEnabled()){
            entityLinker.logStatistics(log);
        }
        //write results (requires a write lock)
        ci.getLock().writeLock().lock();
        try {
            writeEnhancements(ci, entityLinker.getLinkedEntities().values(), language);
        } finally {
            ci.getLock().writeLock().unlock();
        }
    }
View Full Code Here

                textAnnotations.add(ta); //store the registered text annotations
            }
        } finally {
            ci.getLock().readLock().unlock();
        }
        EntityLinker entityLinker = new EntityLinker(at,language,
            languageConfig, entityMentionIndex, linkerConfig, labelTokenizer,entityMentionIndex);
        //process
        try {
            entityLinker.process();
        } catch (EntitySearcherException e) {
            log.error("Unable to link Entities with "+entityLinker,e);
            throw new EngineException(this, ci, "Unable to link Entities with "+entityLinker, e);
        }
        //TODO: write results
        ci.getLock().writeLock().lock();
        try {
            writeComentions(ci,entityLinker.getLinkedEntities().values(), language, textAnnotations);
        } finally {
            ci.getLock().writeLock().unlock();
        }
    }
View Full Code Here

            throw new IllegalStateException("The language '"+language+"' is not configured "
                    + "to be processed by this Engine. As this is already checked within the "
                    + "canEnhance(..) method this may indicate an bug in the used "
                    + "EnhanceemntJobManager implementation!");
        }
        EntityLinker entityLinker = new EntityLinker(at,language,
            languageConfig, entitySearcher, linkerConfig, labelTokenizer);
        //process
        try {
            entityLinker.process();
        } catch (EntitySearcherException e) {
            log.error("Unable to link Entities with "+entityLinker,e);
            throw new EngineException(this, ci, "Unable to link Entities with "+entityLinker, e);
        }
        //write results (requires a write lock)
        ci.getLock().writeLock().lock();
        try {
            writeEnhancements(ci, entityLinker.getLinkedEntities().values(), language);
        } finally {
            ci.getLock().writeLock().unlock();
        }
    }
View Full Code Here

        tpc.setLinkedLexicalCategories(LanguageProcessingConfig.DEFAULT_LINKED_LEXICAL_CATEGORIES);
        tpc.setLinkedPos(Collections.EMPTY_SET);
        EntityLinkerConfig config = new EntityLinkerConfig();
        config.setMinFoundTokens(2);//this is assumed by this test
        config.setRedirectProcessingMode(RedirectProcessingMode.FOLLOW);
        EntityLinker linker = new EntityLinker(TEST_ANALYSED_TEXT,"en",
            tpc, searcher, config, labelTokenizer);
        linker.process();
        Map<String,List<String>> expectedResults = new HashMap<String,List<String>>();
        expectedResults.put("Patrick Marshall", new ArrayList<String>(
                Arrays.asList("urn:test:PatrickMarshall")));
        expectedResults.put("geologist", new ArrayList<String>(
                Arrays.asList("urn:test:redirect:Geologist"))); //the redirected entity
View Full Code Here

        tpc.setLinkedLexicalCategories(Collections.EMPTY_SET);
        tpc.setLinkedPos(LanguageProcessingConfig.DEFAULT_LINKED_POS);
        EntityLinkerConfig config = new EntityLinkerConfig();
        config.setMinFoundTokens(2);//this is assumed by this test
        config.setRedirectProcessingMode(RedirectProcessingMode.FOLLOW);
        EntityLinker linker = new EntityLinker(TEST_ANALYSED_TEXT,"en",
            tpc, searcher, config, labelTokenizer);
        linker.process();
        Map<String,List<String>> expectedResults = new HashMap<String,List<String>>();
        expectedResults.put("Patrick Marshall", new ArrayList<String>(
                Arrays.asList("urn:test:PatrickMarshall")));
        //Geologist is a common noun and MUST NOT be found
        //expectedResults.put("geologist", new ArrayList<String>(
View Full Code Here

TOP

Related Classes of org.apache.stanbol.enhancer.engines.entitylinking.impl.EntityLinker

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.