Example usage for weka.core Stopwords elements

List of usage examples for weka.core Stopwords elements

Introduction

In this page you can find the example usage for weka.core Stopwords elements.

Prototype

public Enumeration<String> elements() 

Source Link

Document

Returns a sorted enumeration over all stored stopwords

Usage

From source file:etc.aloe.filters.WordFeaturesExtractor.java

License:Open Source License

private HashSet<String> prepareStopwords() {
    // initialize stopwords
    Stopwords stops = new Stopwords();
    if (getStopList() != null) {
        try {//from w  w w .  ja v  a 2s .  c  o m
            if (getStopList().exists() && !getStopList().isDirectory()) {
                stops.read(getStopList());
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    HashSet<String> result = new HashSet<String>();
    Enumeration<String> words = (Enumeration<String>) stops.elements();
    while (words.hasMoreElements()) {
        result.add(words.nextElement());
    }
    return result;
}