/** This is the DocumentReaderAndWriter used for reading training and testing files. * It is the DocumentReaderAndWriter specified by the readerAndWriter flag and * defaults to {@code edu.stanford.nlp.sequences.ColumnDocumentReaderAndWriter} which * is suitable for reading CoNLL-style TSV files. * * @return The default DocumentReaderAndWriter */ public synchronized DocumentReaderAndWriter<IN> defaultReaderAndWriter() { if (defaultReaderAndWriter == null) { defaultReaderAndWriter = makeReaderAndWriter(); } return defaultReaderAndWriter; }
/** This is the DocumentReaderAndWriter used for reading training and testing files. * It is the DocumentReaderAndWriter specified by the readerAndWriter flag and * defaults to {@code edu.stanford.nlp.sequences.ColumnDocumentReaderAndWriter} which * is suitable for reading CoNLL-style TSV files. * * @return The default DocumentReaderAndWriter */ public synchronized DocumentReaderAndWriter<IN> defaultReaderAndWriter() { if (defaultReaderAndWriter == null) { defaultReaderAndWriter = makeReaderAndWriter(); } return defaultReaderAndWriter; }
/** * Trains a classifier from a Collection of sequences. * Note that the Collection can be (and usually is) an ObjectBank. * * @param docs * An Objectbank or a collection of sequences of IN */ public void train(Collection<List<IN>> docs) { train(docs, makeReaderAndWriter()); }
public void train(String filename) { train(filename, makeReaderAndWriter()); }
/** * ONLY USE IF LOADED A CHINESE WORD SEGMENTER!!!!! * * @param sentence * The string to be classified * @return List of words */ public List<String> segmentString(String sentence) { // TODO: creating this object is annoying, is there any good way // around it? Why can't we just use a // PlainTextDocumentReaderAndWriter? return segmentString(sentence, makeReaderAndWriter()); }
/** * Train the classifier based on values in flags. It will use the first of * these variables that is defined: trainFiles (and baseTrainDir), * trainFileList, trainFile. */ public void train() { if (flags.trainFiles != null) { train(flags.baseTrainDir, flags.trainFiles, makeReaderAndWriter()); } else if (flags.trainFileList != null) { String[] files = flags.trainFileList.split(","); train(files, makeReaderAndWriter()); } else { train(flags.trainFile, makeReaderAndWriter()); } }
defaultReaderAndWriter = makeReaderAndWriter(); if (flags.readerAndWriter != null && flags.readerAndWriter