Package etc.aloe.filters

Examples of etc.aloe.filters.WordFeaturesExtractor


     * @param examples
     * @return
     * @throws Exception
     */
    protected Filter getUnigramBigramFilter(ExampleSet examples) throws Exception {
        WordFeaturesExtractor filter = new WordFeaturesExtractor();
        filter.setSelectedAttributeName(ExampleSet.MESSAGE_ATTR_NAME);
       
        filter.setLowerCaseTokens(true);
        //use stemming and remove "nonsense"
        filter.setStemmer(new SimpleStringToWordVector.NoNonsenseStemmer(false));

        filter.setUseBigrams(true);
       
        filter.setInputFormat(examples.getInstances());
        Instances filtered = Filter.useFilter(examples.getInstances(), filter);
        examples.setInstances(filtered);

        return filter;
    }
View Full Code Here

TOP

Related Classes of etc.aloe.filters.WordFeaturesExtractor

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.