Package org.apache.stanbol.commons.opennlp

Examples of org.apache.stanbol.commons.opennlp.TextAnalyzer


    @Test
    public void testSingleSentenceNoChunkerNoPosConfig(){
        TextAnalyzerConfig config = new TextAnalyzerConfig();
        config.enablePosTagger(false);
        config.enableChunker(true);//must be ignored for Chunks if no Pos
        TextAnalyzer analyzer = new TextAnalyzer(openNLP,LANGUAGE,config);
        AnalysedText analysed = analyzer.analyseSentence(SINGLE_SENTENCE);
        assertNotNull(analysed);
        //check the default config
        assertFalse(analyzer.getConfig().isSimpleTokenizerForced());
        assertFalse(analyzer.getConfig().isPosTaggerEnable());
        assertTrue(analyzer.getConfig().isChunkerEnabled());
        assertTrue(analyzer.getConfig().isPosTypeChunkerEnabled());
        assertTrue(analyzer.getConfig().isPosTypeChunkerForced());
        checkSingleSentence(analysed,SINGLE_SENTENCE_TOKENS,false,false);
    }
View Full Code Here


        checkSingleSentence(analysed,SINGLE_SENTENCE_TOKENS,false,false);
    }

    @Test
    public void testMultipleSentenceDefaultConfig(){
        TextAnalyzer analyzer = new TextAnalyzer(openNLP,LANGUAGE);
        Iterator<AnalysedText> analysedSentences = analyzer.analyse(MULTI_SENTENCES);
        assertNotNull(analysedSentences);
        int sentenceCount = 0;
        while(analysedSentences.hasNext()){
            AnalysedText analysed = analysedSentences.next();
            checkSingleSentence(analysed, MULTIPLE_SENTENCE_TOKENS[sentenceCount], true, true);
View Full Code Here

TOP

Related Classes of org.apache.stanbol.commons.opennlp.TextAnalyzer

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.