本文整理汇总了Java中edu.stanford.nlp.util.StringUtils.printErrInvocationString方法的典型用法代码示例。如果您正苦于以下问题:Java StringUtils.printErrInvocationString方法的具体用法?Java StringUtils.printErrInvocationString怎么用?Java StringUtils.printErrInvocationString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类edu.stanford.nlp.util.StringUtils
的用法示例。
在下文中一共展示了StringUtils.printErrInvocationString方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: main
import edu.stanford.nlp.util.StringUtils; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
StringUtils.printErrInvocationString("CRFFeatureExporter", args);
Properties props = StringUtils.argsToProperties(args);
CRFClassifier crf = new CRFClassifier(props);
String inputFile = crf.flags.trainFile;
if (inputFile == null) {
System.err.println("Please provide input file using -trainFile");
System.exit(-1);
}
String outputFile = crf.flags.exportFeatures;
if (outputFile == null) {
System.err.println("Please provide output file using -exportFeatures");
System.exit(-1);
}
CRFFeatureExporter featureExporter = new CRFFeatureExporter(crf);
Collection<List<CoreLabel>> docs =
crf.makeObjectBankFromFile(inputFile, crf.makeReaderAndWriter());
crf.makeAnswerArraysAndTagIndex(docs);
featureExporter.printFeatures(outputFile, docs);
}
示例2: main
import edu.stanford.nlp.util.StringUtils; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception
{
StringUtils.printErrInvocationString("MultiClassChunkEvalStats", args);
Properties props = StringUtils.argsToProperties(args);
String boundary = props.getProperty("b","-X-");
String delimiter = props.getProperty("d","\t");
String defaultPosTag = props.getProperty("t", "I");
boolean raw = Boolean.valueOf(props.getProperty("r","false"));
boolean ignoreProvidedTag = Boolean.valueOf(props.getProperty("ignoreProvidedTag","false"));
String format = props.getProperty("format", "conll");
String filename = props.getProperty("i");
String backgroundLabel = props.getProperty("k", "O");
try {
MultiClassPrecisionRecallExtendedStats stats;
if (raw) {
stats = new MultiClassStringLabelStats(backgroundLabel);
} else {
MultiClassChunkEvalStats mstats = new MultiClassChunkEvalStats(backgroundLabel);
mstats.getChunker().setDefaultPosTag(defaultPosTag);
mstats.getChunker().setIgnoreProvidedTag(ignoreProvidedTag);
stats = mstats;
}
if (filename != null) {
stats.score(filename, delimiter, boundary);
} else {
stats.score(new BufferedReader(new InputStreamReader(System.in)), delimiter, boundary);
}
if ("conll".equalsIgnoreCase(format)) {
System.out.println(stats.getConllEvalString());
} else {
System.out.println(stats.getDescription(6));
}
} catch (IOException ex) {
System.err.println("Error processing file: " + ex.toString());
ex.printStackTrace(System.err);
}
}
示例3: main
import edu.stanford.nlp.util.StringUtils; //导入方法依赖的package包/类
/** Command-line version of the classifier. See the class
* comments for examples of use, and SeqClassifierFlags
* for more information on supported flags.
*/
public static void main(String[] args) throws Exception {
StringUtils.printErrInvocationString("CMMClassifier", args);
Properties props = StringUtils.argsToProperties(args);
CMMClassifier<CoreLabel> cmm = new CMMClassifier<CoreLabel>(props);
String testFile = cmm.flags.testFile;
String textFile = cmm.flags.textFile;
String loadPath = cmm.flags.loadClassifier;
String serializeTo = cmm.flags.serializeTo;
// cmm.crossValidateTrainAndTest(trainFile);
if (loadPath != null) {
cmm.loadClassifierNoExceptions(loadPath, props);
} else if (cmm.flags.loadJarClassifier != null) {
cmm.loadJarClassifier(cmm.flags.loadJarClassifier, props);
} else if (cmm.flags.trainFile != null) {
if (cmm.flags.biasedTrainFile != null) {
cmm.trainSemiSup();
} else {
cmm.train();
}
} else {
cmm.loadDefaultClassifier();
}
if (serializeTo != null) {
cmm.serializeClassifier(serializeTo);
}
if (testFile != null) {
cmm.classifyAndWriteAnswers(testFile, cmm.makeReaderAndWriter());
} else if (cmm.flags.testFiles != null) {
cmm.classifyAndWriteAnswers(cmm.flags.baseTestDir, cmm.flags.testFiles,
cmm.makeReaderAndWriter());
}
if (textFile != null) {
DocumentReaderAndWriter<CoreLabel> readerAndWriter =
new PlainTextDocumentReaderAndWriter<CoreLabel>();
cmm.classifyAndWriteAnswers(textFile, readerAndWriter);
}
}