Example usage for opennlp.tools.util.featuregen FeatureGeneratorUtil tokenFeature

List of usage examples for opennlp.tools.util.featuregen FeatureGeneratorUtil tokenFeature

Introduction

In this page you can find the example usage for opennlp.tools.util.featuregen FeatureGeneratorUtil tokenFeature.

Prototype

public static String tokenFeature(String token) 

Source Link

Document

Generates a class name for the specified token.

Usage

From source file:edu.stanford.muse.util.Util.java

public static Set<String> getAcronyms(String content) {
    if (content == null)
        return null;
    Pattern acronymPattern = Pattern.compile("[A-Z]{3,}");

    content = cleanEmailStuff(content);/*from   w w w.  ja va  2 s .  com*/

    Set<String> acrs = new HashSet<String>();
    Matcher m = acronymPattern.matcher(content);
    while (m.find()) {
        String acr = m.group();
        String tt = FeatureGeneratorUtil.tokenFeature(acr);
        if (!tt.equals("ac")) {
            continue;
        }
        acrs.add(acr);
    }
    return acrs;
}