Sha256: aae7a46de8380e48a33f9e9bfdd6bfa82d0e3c37658fb4056b2b842c0ba570bd

Contents?: true

Size: 1.02 KB

Versions: 6

Compression:

Stored size: 1.02 KB

Contents

import java.util.Arrays;
import java.util.ArrayList;
import java.lang.String;
import opennlp.tools.postag.POSTagger;
import opennlp.tools.chunker.ChunkerME;
import opennlp.tools.namefind.NameFinderME; // interface instead?
import opennlp.tools.util.Span;

// javac -cp '.:opennlp.tools.jar' Utils.java
// jar cf utils.jar Utils.class
public class Utils {
    
    public static String[] tagWithArrayList(POSTagger posTagger, ArrayList[] objectArray) {
      return posTagger.tag(getStringArray(objectArray));
    }
    public static Object[] findWithArrayList(NameFinderME nameFinder, ArrayList[] tokens) {
      return nameFinder.find(getStringArray(tokens));
    }
    public static Object[] chunkWithArrays(ChunkerME chunker, ArrayList[] tokens, ArrayList[] tags) {
      return chunker.chunk(getStringArray(tokens), getStringArray(tags));
    }
    public static String[] getStringArray(ArrayList[] objectArray) {
      String[] stringArray = Arrays.copyOf(objectArray, objectArray.length, String[].class);
		  return stringArray;
    }
}

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
open-nlp-0.1.5 bin/Utils.java
open-nlp-0.1.4 bin/Utils.java
open-nlp-0.1.3 bin/Utils.java
open-nlp-0.1.2 bin/Utils.java
open-nlp-0.1.1 bin/Utils.java
open-nlp-0.1.0 bin/Utils.java