• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java CleartkSequenceAnnotator类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.cleartk.ml.CleartkSequenceAnnotator的典型用法代码示例。如果您正苦于以下问题:Java CleartkSequenceAnnotator类的具体用法?Java CleartkSequenceAnnotator怎么用?Java CleartkSequenceAnnotator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



CleartkSequenceAnnotator类属于org.cleartk.ml包,在下文中一共展示了CleartkSequenceAnnotator类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: main

import org.cleartk.ml.CleartkSequenceAnnotator; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
	Options options = CliFactory.parseArguments(Options.class, args);

	// a reader that loads the URIs of the training files
	CollectionReaderDescription reader = CollectionReaderFactory.createReaderDescription(XmiReader.class,
			XmiReader.PARAM_SOURCE_LOCATION, options.getTrainDirectory() + "/*.xmi", XmiReader.PARAM_LENIENT, true);

	// run the pipeline over the training corpus
	SimplePipeline.runPipeline(reader,
			createEngineDescription(ContextWindowAnnotator.class, ContextWindowAnnotator.PARAM_BASE_ANNOTATION,
					FigureMention.class, ContextWindowAnnotator.PARAM_CONTEXT_CLASS, Speech.class,
					ContextWindowAnnotator.PARAM_TARGET_ANNOTATION, TrainingArea.class),
			createEngineDescription(ClearTkMentionAnnotator.class, CleartkSequenceAnnotator.PARAM_IS_TRAINING, true,
					DirectoryDataWriterFactory.PARAM_OUTPUT_DIRECTORY, options.getModelDirectory(),
					DefaultSequenceDataWriterFactory.PARAM_DATA_WRITER_CLASS_NAME,
					MalletCrfStringOutcomeDataWriter.class),
			createEngineDescription(XmiWriter.class, XmiWriter.PARAM_TARGET_LOCATION, "target/"));

	// train a Mallet CRF model on the training data
	Train.main(options.getModelDirectory());
}
 
开发者ID:quadrama,项目名称:DramaNLP,代码行数:22,代码来源:MentionDetectionTraining.java


示例2: testMaxent

import org.cleartk.ml.CleartkSequenceAnnotator; //导入依赖的package包/类
@Test
public void testMaxent() throws Exception {
  String outDirectoryName = outputDirectoryName + "/maxent";

  AnalysisEngineDescription dataWriter = AnalysisEngineFactory.createEngineDescription(
      ExamplePosAnnotator.class,
      CleartkSequenceAnnotator.PARAM_DATA_WRITER_FACTORY_CLASS_NAME,
      ViterbiDataWriterFactory.class.getName(),
      DirectoryDataWriterFactory.PARAM_OUTPUT_DIRECTORY,
      outDirectoryName,
      DefaultDataWriterFactory.PARAM_DATA_WRITER_CLASS_NAME,
      MaxentStringOutcomeDataWriter.class.getName(),
      ViterbiDataWriterFactory.PARAM_OUTCOME_FEATURE_EXTRACTOR_NAMES,
      new String[] { DefaultOutcomeFeatureExtractor.class.getName() });
  testClassifier(dataWriter, outDirectoryName, 10);

  String firstLine = FileUtil.loadListOfStrings(new File(outDirectoryName
      + "/2008_Sichuan_earthquake.txt.pos"))[0];
  assertEquals(
      "2008/CD Sichuan/JJ earthquake/NNS From/IN Wikipedia/NN ,/, the/DT free/NN encyclopedia/IN",
      firstLine);
}
 
开发者ID:ClearTK,项目名称:cleartk,代码行数:23,代码来源:ExamplePosClassifierTest.java


示例3: testMalletMaxent

import org.cleartk.ml.CleartkSequenceAnnotator; //导入依赖的package包/类
@Test
public void testMalletMaxent() throws Exception {
  String outDirectoryName = outputDirectoryName + "/mallet-maxent";

  AnalysisEngineDescription dataWriter = AnalysisEngineFactory.createEngineDescription(
      ExamplePosAnnotator.class,
      CleartkSequenceAnnotator.PARAM_DATA_WRITER_FACTORY_CLASS_NAME,
      ViterbiDataWriterFactory.class.getName(),
      DirectoryDataWriterFactory.PARAM_OUTPUT_DIRECTORY,
      outDirectoryName,
      DefaultDataWriterFactory.PARAM_DATA_WRITER_CLASS_NAME,
      MalletStringOutcomeDataWriter.class.getName(),
      ViterbiDataWriterFactory.PARAM_OUTCOME_FEATURE_EXTRACTOR_NAMES,
      new String[] { DefaultOutcomeFeatureExtractor.class.getName() });
  testClassifier(dataWriter, outDirectoryName, 10, "MaxEnt");

  String firstLine = FileUtil.loadListOfStrings(new File(outDirectoryName
      + "/2008_Sichuan_earthquake.txt.pos"))[0];
  assertEquals(
      "2008/DT Sichuan/JJ earthquake/NN From/IN Wikipedia/NN ,/, the/DT free/NN encyclopedia/NN",
      firstLine);
}
 
开发者ID:ClearTK,项目名称:cleartk,代码行数:23,代码来源:ExamplePosClassifierTest.java


示例4: testMalletNaiveBayes

import org.cleartk.ml.CleartkSequenceAnnotator; //导入依赖的package包/类
@Test
public void testMalletNaiveBayes() throws Exception {
  String outDirectoryName = outputDirectoryName + "/mallet-naive-bayes";

  AnalysisEngineDescription dataWriter = AnalysisEngineFactory.createEngineDescription(
      ExamplePosAnnotator.class,
      CleartkSequenceAnnotator.PARAM_DATA_WRITER_FACTORY_CLASS_NAME,
      ViterbiDataWriterFactory.class.getName(),
      DirectoryDataWriterFactory.PARAM_OUTPUT_DIRECTORY,
      outDirectoryName,
      DefaultDataWriterFactory.PARAM_DATA_WRITER_CLASS_NAME,
      MalletStringOutcomeDataWriter.class.getName(),
      ViterbiDataWriterFactory.PARAM_OUTCOME_FEATURE_EXTRACTOR_NAMES,
      new String[] { DefaultOutcomeFeatureExtractor.class.getName() });
  testClassifier(dataWriter, outDirectoryName, 10, "NaiveBayes");

  String firstLine = FileUtil.loadListOfStrings(new File(outDirectoryName
      + "/2008_Sichuan_earthquake.txt.pos"))[0];
  assertEquals(
      "2008/DT Sichuan/JJ earthquake/NN From/IN Wikipedia/NN ,/, the/DT free/NN encyclopedia/IN",
      firstLine);
}
 
开发者ID:ClearTK,项目名称:cleartk,代码行数:23,代码来源:ExamplePosClassifierTest.java


示例5: testMalletC45

import org.cleartk.ml.CleartkSequenceAnnotator; //导入依赖的package包/类
@Test
public void testMalletC45() throws Exception {
  this.assumeLongTestsEnabled();
  this.logger.info(LONG_TEST_MESSAGE);

  String outDirectoryName = outputDirectoryName + "/mallet-c45";

  AnalysisEngineDescription dataWriter = AnalysisEngineFactory.createEngineDescription(
      ExamplePosAnnotator.class,
      CleartkSequenceAnnotator.PARAM_DATA_WRITER_FACTORY_CLASS_NAME,
      ViterbiDataWriterFactory.class.getName(),
      DirectoryDataWriterFactory.PARAM_OUTPUT_DIRECTORY,
      outDirectoryName,
      DefaultDataWriterFactory.PARAM_DATA_WRITER_CLASS_NAME,
      MalletStringOutcomeDataWriter.class.getName(),
      ViterbiDataWriterFactory.PARAM_OUTCOME_FEATURE_EXTRACTOR_NAMES,
      new String[] { DefaultOutcomeFeatureExtractor.class.getName() });
  testClassifier(dataWriter, outDirectoryName, 10, "C45");

  String firstLine = FileUtil.loadListOfStrings(new File(outDirectoryName
      + "/2008_Sichuan_earthquake.txt.pos"))[0];
  assertEquals(
      "2008/CD Sichuan/JJ earthquake/NN From/NN Wikipedia/NN ,/, the/DT free/NN encyclopedia/NN",
      firstLine);
}
 
开发者ID:ClearTK,项目名称:cleartk,代码行数:26,代码来源:ExamplePosClassifierTest.java


示例6: getWriterDescription

import org.cleartk.ml.CleartkSequenceAnnotator; //导入依赖的package包/类
public static AnalysisEngineDescription getWriterDescription(String outputDirectory)
		throws ResourceInitializationException {
	return AnalysisEngineFactory.createEngineDescription(ReasonAnnotator.class,
			CleartkSequenceAnnotator.PARAM_IS_TRAINING, true, DirectoryDataWriterFactory.PARAM_OUTPUT_DIRECTORY,
			outputDirectory, DefaultSequenceDataWriterFactory.PARAM_DATA_WRITER_CLASS_NAME,
			MalletCrfStringOutcomeDataWriter.class);
}
 
开发者ID:IE4OpenData,项目名称:Octroy,代码行数:8,代码来源:ReasonAnnotator.java


示例7: train

import org.cleartk.ml.CleartkSequenceAnnotator; //导入依赖的package包/类
@Override
public void train(CollectionReader collectionReader, File outputDirectory) throws Exception {
	// assemble the training pipeline
	AggregateBuilder aggregate = new AggregateBuilder();

	aggregate
			.add(createEngineDescription(ContextWindowAnnotator.class, ContextWindowAnnotator.PARAM_BASE_ANNOTATION,
					FigureMention.class, ContextWindowAnnotator.PARAM_CONTEXT_CLASS, Speech.class,
					ContextWindowAnnotator.PARAM_TARGET_ANNOTATION, TrainingArea.class));
	// our NamedEntityChunker annotator, configured to write Mallet CRF
	// training data
	aggregate.add(AnalysisEngineFactory.createEngineDescription(ClearTkMentionAnnotator.class,
			CleartkSequenceAnnotator.PARAM_IS_TRAINING, true, DirectoryDataWriterFactory.PARAM_OUTPUT_DIRECTORY,
			outputDirectory, DefaultSequenceDataWriterFactory.PARAM_DATA_WRITER_CLASS_NAME,
			MalletCrfStringOutcomeDataWriter.class));

	// run the pipeline over the training corpus
	SimplePipeline.runPipeline(collectionReader, aggregate.createAggregateDescription());

	// quiet Mallet down a bit (but still leave likelihoods so you can see
	// progress)
	Logger malletLogger = Logger.getLogger("cc.mallet");
	malletLogger.setLevel(Level.WARNING);
	Logger likelihoodLogger = Logger.getLogger("cc.mallet.fst.CRFOptimizableByLabelLikelihood");
	likelihoodLogger.setLevel(Level.INFO);

	// train a Mallet CRF model on the training data
	Train.main(outputDirectory);

}
 
开发者ID:quadrama,项目名称:DramaNLP,代码行数:31,代码来源:MentionDetectionEvaluation.java


示例8: getWriterDescription

import org.cleartk.ml.CleartkSequenceAnnotator; //导入依赖的package包/类
public static AnalysisEngineDescription getWriterDescription(String outputDirectory)
    throws ResourceInitializationException {
  return AnalysisEngineFactory.createEngineDescription(
      ExamplePosAnnotator.class,
      CleartkSequenceAnnotator.PARAM_DATA_WRITER_FACTORY_CLASS_NAME,
      ViterbiDataWriterFactory.class.getName(),
      DirectoryDataWriterFactory.PARAM_OUTPUT_DIRECTORY,
      outputDirectory,
      ViterbiDataWriterFactory.PARAM_DELEGATED_DATA_WRITER_FACTORY_CLASS,
      DefaultDataWriterFactory.class.getName(),
      DefaultDataWriterFactory.PARAM_DATA_WRITER_CLASS_NAME,
      MaxentStringOutcomeDataWriter.class.getName(),
      ViterbiDataWriterFactory.PARAM_OUTCOME_FEATURE_EXTRACTOR_NAMES,
      new String[] { DefaultOutcomeFeatureExtractor.class.getName() });
}
 
开发者ID:ClearTK,项目名称:cleartk,代码行数:16,代码来源:ExamplePosAnnotator.java


示例9: train

import org.cleartk.ml.CleartkSequenceAnnotator; //导入依赖的package包/类
@Override
public void train(CollectionReader collectionReader, File outputDirectory) throws Exception {
  // assemble the training pipeline
  AggregateBuilder aggregate = new AggregateBuilder();

  // an annotator that loads the text from the training file URIs
  aggregate.add(UriToDocumentTextAnnotator.getDescription());

  // an annotator that parses and loads MASC named entity annotations (and tokens)
  aggregate.add(MascGoldAnnotator.getDescription());

  // an annotator that adds part-of-speech tags
  aggregate.add(PosTaggerAnnotator.getDescription());

  // our NamedEntityChunker annotator, configured to write Mallet CRF training data
  aggregate.add(AnalysisEngineFactory.createEngineDescription(
      NamedEntityChunker.class,
      CleartkSequenceAnnotator.PARAM_IS_TRAINING,
      true,
      DirectoryDataWriterFactory.PARAM_OUTPUT_DIRECTORY,
      outputDirectory,
      DefaultSequenceDataWriterFactory.PARAM_DATA_WRITER_CLASS_NAME,
      MalletCrfStringOutcomeDataWriter.class));

  // run the pipeline over the training corpus
  SimplePipeline.runPipeline(collectionReader, aggregate.createAggregateDescription());

  // quiet Mallet down a bit (but still leave likelihoods so you can see progress)
  Logger malletLogger = Logger.getLogger("cc.mallet");
  malletLogger.setLevel(Level.WARNING);
  Logger likelihoodLogger = Logger.getLogger("cc.mallet.fst.CRFOptimizableByLabelLikelihood");
  likelihoodLogger.setLevel(Level.INFO);

  // train a Mallet CRF model on the training data
  Train.main(outputDirectory);

}
 
开发者ID:ClearTK,项目名称:cleartk,代码行数:38,代码来源:EvaluateNamedEntityChunker.java


示例10: main

import org.cleartk.ml.CleartkSequenceAnnotator; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
  Options options = CliFactory.parseArguments(Options.class, args);

  // a reader that loads the URIs of the text file
  CollectionReader reader = UriCollectionReader.getCollectionReaderFromFiles(Arrays.asList(options.getTextFile()));

  // assemble the classification pipeline
  AggregateBuilder aggregate = new AggregateBuilder();

  // an annotator that loads the text from the training file URIs
  aggregate.add(UriToDocumentTextAnnotator.getDescription());

  // annotators that identify sentences, tokens and part-of-speech tags in the text
  aggregate.add(SentenceAnnotator.getDescription());
  aggregate.add(TokenAnnotator.getDescription());
  aggregate.add(PosTaggerAnnotator.getDescription());

  // our NamedEntityChunker annotator, configured to classify on the new texts
  aggregate.add(AnalysisEngineFactory.createEngineDescription(
      NamedEntityChunker.class,
      CleartkSequenceAnnotator.PARAM_IS_TRAINING,
      false,
      GenericJarClassifierFactory.PARAM_CLASSIFIER_JAR_PATH,
      JarClassifierBuilder.getModelJarFile(options.getModelDirectory())));

  // a very simple annotator that just prints out any named entities we found
  aggregate.add(AnalysisEngineFactory.createEngineDescription(PrintNamedEntityMentions.class));

  // run the classification pipeline on the new texts
  SimplePipeline.runPipeline(reader, aggregate.createAggregateDescription());
}
 
开发者ID:ClearTK,项目名称:cleartk,代码行数:32,代码来源:RunNamedEntityChunker.java


示例11: main

import org.cleartk.ml.CleartkSequenceAnnotator; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
  Options options = CliFactory.parseArguments(Options.class, args);

  // a reader that loads the URIs of the training files
  CollectionReaderDescription reader = UriCollectionReader.getDescriptionFromDirectory(
      options.getTrainDirectory(),
      MascTextFileFilter.class,
      null);

  // assemble the training pipeline
  AggregateBuilder aggregate = new AggregateBuilder();

  // an annotator that loads the text from the training file URIs
  aggregate.add(UriToDocumentTextAnnotator.getDescription());

  // an annotator that parses and loads MASC named entity annotations (and tokens)
  aggregate.add(MascGoldAnnotator.getDescription());

  // an annotator that adds part-of-speech tags (so we can use them for features)
  aggregate.add(PosTaggerAnnotator.getDescription());

  // our NamedEntityChunker annotator, configured to write Mallet CRF training data
  aggregate.add(AnalysisEngineFactory.createEngineDescription(
      NamedEntityChunker.class,
      CleartkSequenceAnnotator.PARAM_IS_TRAINING,
      true,
      DirectoryDataWriterFactory.PARAM_OUTPUT_DIRECTORY,
      options.getModelDirectory(),
      DefaultSequenceDataWriterFactory.PARAM_DATA_WRITER_CLASS_NAME,
      MalletCrfStringOutcomeDataWriter.class));

  // run the pipeline over the training corpus
  SimplePipeline.runPipeline(reader, aggregate.createAggregateDescription());

  // train a Mallet CRF model on the training data
  Train.main(options.getModelDirectory());
}
 
开发者ID:ClearTK,项目名称:cleartk,代码行数:38,代码来源:TrainNamedEntityChunker.java


示例12: testLibsvm

import org.cleartk.ml.CleartkSequenceAnnotator; //导入依赖的package包/类
@Test
public void testLibsvm() throws Exception {
  String outDirectoryName = outputDirectoryName + "/libsvm";

  AnalysisEngineDescription dataWriter = AnalysisEngineFactory.createEngineDescription(
      ExamplePosAnnotator.class,
      CleartkSequenceAnnotator.PARAM_DATA_WRITER_FACTORY_CLASS_NAME,
      ViterbiDataWriterFactory.class.getName(),
      DirectoryDataWriterFactory.PARAM_OUTPUT_DIRECTORY,
      outDirectoryName,
      DefaultDataWriterFactory.PARAM_DATA_WRITER_CLASS_NAME,
      LibSvmStringOutcomeDataWriter.class.getName(),
      ViterbiDataWriterFactory.PARAM_OUTCOME_FEATURE_EXTRACTOR_NAMES,
      new String[] { DefaultOutcomeFeatureExtractor.class.getName() });

  testClassifier(dataWriter, outDirectoryName, 1, "-t", "0"); // MultiClassLIBSVMClassifier.score
                                                              // is not implemented so we cannot
                                                              // have a stack size greater than 1.
  String firstLine = FileUtil.loadListOfStrings(new File(outDirectoryName
      + "/2008_Sichuan_earthquake.txt.pos"))[0].trim();
  boolean badTags = firstLine.equals("2008/NN Sichuan/NN earthquake/NN From/NN Wikipedia/NN ,/NN the/NN free/NN encyclopedia/NN");
  assertFalse(badTags);
  assertEquals(
      "2008/NN Sichuan/NN earthquake/NN From/IN Wikipedia/NN ,/, the/DT free/NN encyclopedia/NN",
      firstLine);

}
 
开发者ID:ClearTK,项目名称:cleartk,代码行数:28,代码来源:ExamplePosClassifierTest.java


示例13: testSVMLIGHT

import org.cleartk.ml.CleartkSequenceAnnotator; //导入依赖的package包/类
@Test
public void testSVMLIGHT() throws Exception {
  this.assumeTestsEnabled(SVMLIGHT_TESTS_PROPERTY_VALUE);
  this.logger.info(SVMLIGHT_TESTS_ENABLED_MESSAGE);

  String outDirectoryName = outputDirectoryName + "/svmlight";
  AnalysisEngineDescription dataWriter = AnalysisEngineFactory.createEngineDescription(
      ExamplePosAnnotator.class,
      CleartkSequenceAnnotator.PARAM_DATA_WRITER_FACTORY_CLASS_NAME,
      ViterbiDataWriterFactory.class.getName(),
      DirectoryDataWriterFactory.PARAM_OUTPUT_DIRECTORY,
      outDirectoryName,
      DefaultDataWriterFactory.PARAM_DATA_WRITER_CLASS_NAME,
      SvmLightStringOutcomeDataWriter.class.getName(),
      ViterbiDataWriterFactory.PARAM_OUTCOME_FEATURE_EXTRACTOR_NAMES,
      new String[] { DefaultOutcomeFeatureExtractor.class.getName() });
  testClassifier(dataWriter, outDirectoryName, 1);

  String firstLine = FileUtil.loadListOfStrings(new File(outDirectoryName
      + "/2008_Sichuan_earthquake.txt.pos"))[0].trim();
  boolean badTags = firstLine.equals("2008/NN Sichuan/NN earthquake/NN From/NN Wikipedia/NN ,/NN the/NN free/NN encyclopedia/NN");
  assertFalse(badTags);

  assertEquals(
      "2008/CD Sichuan/JJ earthquake/NNS From/IN Wikipedia/NN ,/, the/DT free/NN encyclopedia/IN",
      firstLine);
}
 
开发者ID:ClearTK,项目名称:cleartk,代码行数:28,代码来源:ExamplePosClassifierTest.java


示例14: testDataWriterDescriptor

import org.cleartk.ml.CleartkSequenceAnnotator; //导入依赖的package包/类
@Test
public void testDataWriterDescriptor() throws UIMAException {
  AnalysisEngine engine = AnalysisEngineFactory.createEngine(ExamplePosAnnotator.getWriterDescription(ExamplePosAnnotator.DEFAULT_OUTPUT_DIRECTORY));

  String outputDir = (String) engine.getConfigParameterValue(DirectoryDataWriterFactory.PARAM_OUTPUT_DIRECTORY);
  outputDir = outputDir.replace(File.separatorChar, '/');
  Assert.assertEquals(ExamplePosAnnotator.DEFAULT_OUTPUT_DIRECTORY, outputDir);

  String expectedDataWriterFactory = (ViterbiDataWriterFactory.class.getName());
  Object dataWriter = engine.getConfigParameterValue(CleartkSequenceAnnotator.PARAM_DATA_WRITER_FACTORY_CLASS_NAME);
  Assert.assertEquals(expectedDataWriterFactory, dataWriter);
  engine.collectionProcessComplete();
}
 
开发者ID:ClearTK,项目名称:cleartk,代码行数:14,代码来源:ExamplePosAnnotatorTest.java


示例15: getWriterDescription

import org.cleartk.ml.CleartkSequenceAnnotator; //导入依赖的package包/类
public AnalysisEngineDescription getWriterDescription(File directory, Model.Params params)
    throws ResourceInitializationException {
  AnalysisEngineDescription desc;
  if (params.nViterbiOutcomes > 0) {
    desc = AnalysisEngineFactory.createEngineDescription(
        this.annotatorClass,
        CleartkSequenceAnnotator.PARAM_DATA_WRITER_FACTORY_CLASS_NAME,
        ViterbiDataWriterFactory.class,
        ViterbiDataWriterFactory.PARAM_DELEGATED_DATA_WRITER_FACTORY_CLASS,
        DefaultDataWriterFactory.class,
        DefaultDataWriterFactory.PARAM_DATA_WRITER_CLASS_NAME,
        params.dataWriterClass,
        ViterbiDataWriterFactory.PARAM_OUTCOME_FEATURE_EXTRACTOR_NAMES,
        DefaultOutcomeFeatureExtractor.class,
        DefaultOutcomeFeatureExtractor.PARAM_MOST_RECENT_OUTCOME,
        1,
        DefaultOutcomeFeatureExtractor.PARAM_LEAST_RECENT_OUTCOME,
        params.nViterbiOutcomes,
        DirectoryDataWriterFactory.PARAM_OUTPUT_DIRECTORY,
        this.getModelDirectory(directory, params));
  } else {
    String datatWriterParamName;
    if (SequenceDataWriter.class.isAssignableFrom(params.dataWriterClass)) {
      datatWriterParamName = DefaultSequenceDataWriterFactory.PARAM_DATA_WRITER_CLASS_NAME;
    } else if (DataWriter.class.isAssignableFrom(params.dataWriterClass)) {
      datatWriterParamName = DefaultDataWriterFactory.PARAM_DATA_WRITER_CLASS_NAME;
    } else {
      throw new RuntimeException("Invalid data writer class: " + params.dataWriterClass);
    }
    desc = AnalysisEngineFactory.createEngineDescription(
        this.annotatorClass,
        datatWriterParamName,
        params.dataWriterClass,
        DirectoryDataWriterFactory.PARAM_OUTPUT_DIRECTORY,
        this.getModelDirectory(directory, params));
  }
  return desc;
}
 
开发者ID:ClearTK,项目名称:cleartk,代码行数:39,代码来源:Model.java


示例16: testIsTraining

import org.cleartk.ml.CleartkSequenceAnnotator; //导入依赖的package包/类
@Test
public void testIsTraining() throws Throwable {
  StringTestAnnotator annotator = new StringTestAnnotator();
  assertFalse(annotator.isTraining());

  annotator.initialize(UimaContextFactory.createUimaContext(
      CleartkSequenceAnnotator.PARAM_DATA_WRITER_FACTORY_CLASS_NAME,
      StringDataWriter.class.getName()));
  assertTrue(annotator.isTraining());

  annotator.initialize(UimaContextFactory.createUimaContext(
      CleartkSequenceAnnotator.PARAM_DATA_WRITER_FACTORY_CLASS_NAME,
      StringDataWriter.class.getName(),
      CleartkSequenceAnnotator.PARAM_CLASSIFIER_FACTORY_CLASS_NAME,
      StringTestClassifierFactory.class.getName(),
      CleartkSequenceAnnotator.PARAM_IS_TRAINING,
      false));
  assertFalse(annotator.isTraining());

  annotator.initialize(UimaContextFactory.createUimaContext(
      CleartkSequenceAnnotator.PARAM_DATA_WRITER_FACTORY_CLASS_NAME,
      StringDataWriter.class.getName(),
      CleartkSequenceAnnotator.PARAM_CLASSIFIER_FACTORY_CLASS_NAME,
      StringTestClassifierFactory.class.getName(),
      CleartkSequenceAnnotator.PARAM_IS_TRAINING,
      true));
  assertTrue(annotator.isTraining());
}
 
开发者ID:ClearTK,项目名称:cleartk,代码行数:29,代码来源:CleartkSequenceAnnotatorTest.java


示例17: testBadFileName

import org.cleartk.ml.CleartkSequenceAnnotator; //导入依赖的package包/类
@Test
public void testBadFileName() throws Throwable {
  try {
    CleartkSequenceAnnotator<String> classifierAnnotator = new StringTestAnnotator();
    classifierAnnotator.initialize(UimaContextFactory.createUimaContext(
        GenericJarClassifierFactory.PARAM_CLASSIFIER_JAR_PATH,
        new File(outputDirectoryName, "asdf.jar").getPath()));
    classifierAnnotator.classify(Collections.singletonList(InstanceFactory.createInstance(
        "hello",
        1,
        1)));
    fail("expected exception for invalid classifier name");
  } catch (ResourceInitializationException e) {
  }
}
 
开发者ID:ClearTK,项目名称:cleartk,代码行数:16,代码来源:CleartkSequenceAnnotatorTest.java


示例18: testStringClassifierStringAnnotator

import org.cleartk.ml.CleartkSequenceAnnotator; //导入依赖的package包/类
@Test
public void testStringClassifierStringAnnotator() throws Exception {
  CleartkSequenceAnnotator<String> classifierAnnotator = new StringTestAnnotator();
  classifierAnnotator.initialize(UimaContextFactory.createUimaContext(
      CleartkSequenceAnnotator.PARAM_CLASSIFIER_FACTORY_CLASS_NAME,
      StringTestClassifierFactory.class.getName()));
  classifierAnnotator.classify(Collections.singletonList(InstanceFactory.createInstance(
      "hello",
      1,
      1)));
}
 
开发者ID:ClearTK,项目名称:cleartk,代码行数:12,代码来源:CleartkSequenceAnnotatorTest.java


示例19: testIntegerClassifierStringAnnotator

import org.cleartk.ml.CleartkSequenceAnnotator; //导入依赖的package包/类
@Test
public void testIntegerClassifierStringAnnotator() throws Exception {
  try {
    new StringTestAnnotator().initialize(UimaContextFactory.createUimaContext(
        CleartkSequenceAnnotator.PARAM_CLASSIFIER_FACTORY_CLASS_NAME,
        IntegerTestClassifierFactory.class.getName()));
    fail("expected exception for Integer classifier and String annotator");
  } catch (ResourceInitializationException e) {
  }
}
 
开发者ID:ClearTK,项目名称:cleartk,代码行数:11,代码来源:CleartkSequenceAnnotatorTest.java


示例20: testChildClassifierParentAnnotator

import org.cleartk.ml.CleartkSequenceAnnotator; //导入依赖的package包/类
@Test
public void testChildClassifierParentAnnotator() throws Exception {
  CleartkSequenceAnnotator<Parent> classifierAnnotator = new ParentTestAnnotator();
  classifierAnnotator.initialize(UimaContextFactory.createUimaContext(
      CleartkSequenceAnnotator.PARAM_CLASSIFIER_FACTORY_CLASS_NAME,
      ChildTestClassifierFactory.class.getName()));
}
 
开发者ID:ClearTK,项目名称:cleartk,代码行数:8,代码来源:CleartkSequenceAnnotatorTest.java



注:本文中的org.cleartk.ml.CleartkSequenceAnnotator类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Updatability类代码示例发布时间:2022-05-22
下一篇:
Java RemoveDefaultAclRequestProto类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap