/** * Transfer some Pipes from the feature pipe to the tokenization pipe. * The feature pipe must be a SerialPipes. This will destructively modify the CRF object of the extractor. * This is useful if you have a CRF hat has been trained from a single pipe, which you need to split up * int feature and tokenization pipes */ public void slicePipes (int num) { Pipe fpipe = getFeaturePipe (); if (!(fpipe instanceof SerialPipes)) throw new IllegalArgumentException ("slicePipes: FeaturePipe must be a SerialPipes."); SerialPipes sp = (SerialPipes) fpipe; ArrayList pipes = new ArrayList (); for (int i = 0; i < num; i++) { pipes.add (sp.getPipe (0)); //sp.removePipe (0); TODO Fix this } //setTokenizationPipe (sp); TODO Fix this throw new UnsupportedOperationException ("Not yet implemented..."); }
/** * Transfer some Pipes from the feature pipe to the tokenization pipe. * The feature pipe must be a SerialPipes. This will destructively modify the CRF object of the extractor. * This is useful if you have a CRF hat has been trained from a single pipe, which you need to split up * int feature and tokenization pipes */ public void slicePipes (int num) { Pipe fpipe = getFeaturePipe (); if (!(fpipe instanceof SerialPipes)) throw new IllegalArgumentException ("slicePipes: FeaturePipe must be a SerialPipes."); SerialPipes sp = (SerialPipes) fpipe; ArrayList pipes = new ArrayList (); for (int i = 0; i < num; i++) { pipes.add (sp.getPipe (0)); //sp.removePipe (0); TODO Fix this } //setTokenizationPipe (sp); TODO Fix this throw new UnsupportedOperationException ("Not yet implemented..."); }
/** * Transfer some Pipes from the feature pipe to the tokenization pipe. * The feature pipe must be a SerialPipes. This will destructively modify the CRF object of the extractor. * This is useful if you have a CRF hat has been trained from a single pipe, which you need to split up * int feature and tokenization pipes */ public void slicePipes (int num) { Pipe fpipe = getFeaturePipe (); if (!(fpipe instanceof SerialPipes)) throw new IllegalArgumentException ("slicePipes: FeaturePipe must be a SerialPipes."); SerialPipes sp = (SerialPipes) fpipe; ArrayList pipes = new ArrayList (); for (int i = 0; i < num; i++) { pipes.add (sp.getPipe (0)); //sp.removePipe (0); TODO Fix this } //setTokenizationPipe (sp); TODO Fix this throw new UnsupportedOperationException ("Not yet implemented..."); }
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 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 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); } }
static CRFExtractor hackCrfExtor (CRF crf) { Pipe[] newPipes = new Pipe [3]; SerialPipes pipes = (SerialPipes) crf.getInputPipe (); for (int i = 0; i < 3; i++) { Pipe p0 = pipes.getPipe (0); //pipes.removePipe (0); TODO Fix me //p0.setParent (null); newPipes[i] = p0; } Pipe tokPipe = new SerialPipes (newPipes); CRFExtractor extor = new CRFExtractor (crf, (Pipe)tokPipe); return extor; }
static CRFExtractor hackCrfExtor (CRF crf) { Pipe[] newPipes = new Pipe [3]; SerialPipes pipes = (SerialPipes) crf.getInputPipe (); for (int i = 0; i < 3; i++) { Pipe p0 = pipes.getPipe (0); //pipes.removePipe (0); TODO Fix me //p0.setParent (null); newPipes[i] = p0; } Pipe tokPipe = new SerialPipes (newPipes); CRFExtractor extor = new CRFExtractor (crf, (Pipe)tokPipe); return extor; }