当前位置: 首页>>代码示例>>Java>>正文


Java StringUtils.printErrInvocationString方法代码示例

本文整理汇总了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);
}
 
开发者ID:paulirwin,项目名称:Stanford.NER.Net,代码行数:21,代码来源:CRFFeatureExporter.java

示例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);
  }
}
 
开发者ID:paulirwin,项目名称:Stanford.NER.Net,代码行数:38,代码来源:MultiClassChunkEvalStats.java

示例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);
  }
}
 
开发者ID:paulirwin,项目名称:Stanford.NER.Net,代码行数:47,代码来源:CMMClassifier.java


注:本文中的edu.stanford.nlp.util.StringUtils.printErrInvocationString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。