public Pipe createPipe () { return new SerialPipes (new Pipe[] { new CharSequence2TokenSequence (), new TokenSequenceLowercase (), new TokenSequence2FeatureSequence (), new FeatureSequence2FeatureVector ()}); }
public static Pipe concatenatePipes (Pipe p1, Pipe p2) { Alphabet dataDict = combinedDataDicts (p1, p2); Alphabet targetDict = combinedTargetDicts (p1, p2); Pipe ret = new SerialPipes (new Pipe[] { p1, p2 }); if (dataDict != null) ret.dataAlphabetResolved = true; if (targetDict != null) ret.targetAlphabetResolved = true; ret.dataAlphabet = dataDict; ret.targetAlphabet = targetDict; return ret; }
public Instance next () { // Make sure this is not an Instance we were supposed to skip. assert (testingPipe.precondition(source.peekNext())); return source.next(); } public boolean hasNext () {
public static void setInProduction(Pipe p, boolean value) { if (p instanceof AddClassifierTokenPredictions) ((AddClassifierTokenPredictions) p).setInProduction(value); else if (p instanceof SerialPipes) { SerialPipes sp = (SerialPipes) p; for (int i = 0; i < sp.size(); i++) setInProduction(sp.getPipe(i), value); } }
public boolean hasNext () { return source.hasNext() && testingPipe.precondition(source.peekNext()); } public void remove () { throw new IllegalStateException ("This Iterator<Instance> does not support remove()."); }
public CRF (Pipe inputPipe, Pipe outputPipe) { super (inputPipe, outputPipe); this.inputAlphabet = inputPipe.getDataAlphabet(); this.outputAlphabet = inputPipe.getTargetAlphabet(); //inputAlphabet.stopGrowth(); }
/** Remove whitespace-separated tokens in file "wordlist" to the stoplist. */ public TokenSequenceRemoveStopwords removeStopWords (File wordlist) { this.removeStopWords (fileToStringArray(wordlist, null)); return this; }
/** Returns the <code>Alphabet</code> mapping features of the data to * integers. */ public Alphabet getDataAlphabet () { if (dataAlphabet == null && pipe != null) { dataAlphabet = pipe.getDataAlphabet (); } assert (pipe == null || pipe.getDataAlphabet () == null || pipe.getDataAlphabet () == dataAlphabet); return dataAlphabet; }
/** Given an InstanceIterator, return a new InstanceIterator whose instances * have also been processed by this pipe. If you override this method, be sure to check * and obey this pipe's {@link skipIfFalse(Instance)} method. */ public Iterator<Instance> newIteratorFrom (Iterator<Instance> source) { return new SimplePipeInstanceIterator (source); }
public TokenSequenceRemoveStopwords (boolean caseSensitive, boolean markDeletions) { stoplist = newDefaultStopList(); this.caseSensitive = caseSensitive; this.markDeletions = markDeletions; }
public Pipe createPipe () { return new SerialPipes (new Pipe[] { new CharSequence2TokenSequence (), new TokenSequenceLowercase (), new TokenSequence2FeatureSequence (), new FeatureSequence2FeatureVector ()}); }
public static Pipe concatenatePipes (Pipe p1, Pipe p2) { Alphabet dataDict = combinedDataDicts (p1, p2); Alphabet targetDict = combinedTargetDicts (p1, p2); Pipe ret = new SerialPipes (new Pipe[] { p1, p2 }); if (dataDict != null) ret.dataAlphabetResolved = true; if (targetDict != null) ret.targetAlphabetResolved = true; ret.dataAlphabet = dataDict; ret.targetAlphabet = targetDict; return ret; }
public Instance next () { // Make sure this is not an Instance we were supposed to skip. assert (testingPipe.precondition(source.peekNext())); return source.next(); } public boolean hasNext () {
public static void setInProduction(Pipe p, boolean value) { if (p instanceof AddClassifierTokenPredictions) ((AddClassifierTokenPredictions) p).setInProduction(value); else if (p instanceof SerialPipes) { SerialPipes sp = (SerialPipes) p; for (int i = 0; i < sp.size(); i++) setInProduction(sp.getPipe(i), value); } }
public boolean hasNext () { return source.hasNext() && testingPipe.precondition(source.peekNext()); } public void remove () { throw new IllegalStateException ("This Iterator<Instance> does not support remove()."); }
public HMM(Pipe inputPipe, Pipe outputPipe) { this.inputPipe = inputPipe; this.outputPipe = outputPipe; this.inputAlphabet = inputPipe.getDataAlphabet(); this.outputAlphabet = inputPipe.getTargetAlphabet(); }
public static Pipe concatenatePipes (Pipe p1, Pipe p2) { Alphabet dataDict = combinedDataDicts (p1, p2); Alphabet targetDict = combinedTargetDicts (p1, p2); Pipe ret = new SerialPipes (new Pipe[] { p1, p2 }); if (dataDict != null) ret.dataAlphabetResolved = true; if (targetDict != null) ret.targetAlphabetResolved = true; ret.dataAlphabet = dataDict; ret.targetAlphabet = targetDict; return ret; }
public Instance next () { // Make sure this is not an Instance we were supposed to skip. assert (testingPipe.precondition(source.peekNext())); return source.next(); } public boolean hasNext () {
public static void setInProduction(Pipe p, boolean value) { if (p instanceof AddClassifierTokenPredictions) ((AddClassifierTokenPredictions) p).setInProduction(value); else if (p instanceof SerialPipes) { SerialPipes sp = (SerialPipes) p; for (int i = 0; i < sp.size(); i++) setInProduction(sp.getPipe(i), value); } }
public boolean hasNext () { return source.hasNext() && testingPipe.precondition(source.peekNext()); } public void remove () { throw new IllegalStateException ("This Iterator<Instance> does not support remove()."); }