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


Java CoreAnnotation类代码示例

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


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

示例1: requirementsSatisfied

import edu.stanford.nlp.ling.CoreAnnotation; //导入依赖的package包/类
@Override public Set<Class<? extends CoreAnnotation>> requirementsSatisfied() {
    return new HashSet<>(Arrays.asList(
            CoreAnnotations.TextAnnotation.class,
            CoreAnnotations.TokensAnnotation.class,
            CoreAnnotations.CharacterOffsetBeginAnnotation.class,
            CoreAnnotations.CharacterOffsetEndAnnotation.class,
            CoreAnnotations.BeforeAnnotation.class,
            CoreAnnotations.AfterAnnotation.class,
            CoreAnnotations.TokenBeginAnnotation.class,
            CoreAnnotations.TokenEndAnnotation.class,
            CoreAnnotations.PositionAnnotation.class,
            CoreAnnotations.IndexAnnotation.class,
            CoreAnnotations.OriginalTextAnnotation.class,
            CoreAnnotations.ValueAnnotation.class,
            CoreAnnotations.SentencesAnnotation.class,
            CoreAnnotations.SentenceIndexAnnotation.class
    ));
}
 
开发者ID:dhfbk,项目名称:tint,代码行数:19,代码来源:ItalianTokenizerAnnotator.java

示例2: requires

import edu.stanford.nlp.ling.CoreAnnotation; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public Set<Class<? extends CoreAnnotation>> requires() {
    Set<Class<? extends CoreAnnotation>> requirements = new HashSet<>(Arrays.asList(
            CoreAnnotations.TextAnnotation.class,
            CoreAnnotations.TokensAnnotation.class,
            CoreAnnotations.IndexAnnotation.class,
            CoreAnnotations.SentencesAnnotation.class,
            CoreAnnotations.SentenceIndexAnnotation.class,
            CoreAnnotations.PartOfSpeechAnnotation.class,
            CoreAnnotations.LemmaAnnotation.class,
            SemanticGraphCoreAnnotations.BasicDependenciesAnnotation.class,
            SemanticGraphCoreAnnotations.CollapsedDependenciesAnnotation.class,
            SemanticGraphCoreAnnotations.CollapsedCCProcessedDependenciesAnnotation.class,
            CoreAnnotations.OriginalTextAnnotation.class
    ));
    return Collections.unmodifiableSet(requirements);
}
 
开发者ID:intel-analytics,项目名称:InformationExtraction,代码行数:21,代码来源:IntelKBPAnnotator.java

示例3: requires

import edu.stanford.nlp.ling.CoreAnnotation; //导入依赖的package包/类
@Override
/**
 * Using the same requirements as the CoreNLP NERCombinerAnnotator
 */
public Set<Class<? extends CoreAnnotation>> requires() {
    return Collections.unmodifiableSet(new HashSet<>(Arrays.asList(
            CoreAnnotations.TextAnnotation.class,
            CoreAnnotations.TokensAnnotation.class,
            CoreAnnotations.SentencesAnnotation.class,
            CoreAnnotations.CharacterOffsetBeginAnnotation.class,
            CoreAnnotations.CharacterOffsetEndAnnotation.class,
            CoreAnnotations.PartOfSpeechAnnotation.class,
            CoreAnnotations.LemmaAnnotation.class,
            CoreAnnotations.BeforeAnnotation.class,
            CoreAnnotations.AfterAnnotation.class,
            CoreAnnotations.TokenBeginAnnotation.class,
            CoreAnnotations.TokenEndAnnotation.class,
            CoreAnnotations.IndexAnnotation.class,
            CoreAnnotations.OriginalTextAnnotation.class,
            CoreAnnotations.SentenceIndexAnnotation.class
        )));
}
 
开发者ID:toliwa,项目名称:CoreNLP-jMWE,代码行数:23,代码来源:JMWEAnnotator.java

示例4: arcLabelsToNode

import edu.stanford.nlp.ling.CoreAnnotation; //导入依赖的package包/类
/**
 * Finds all arcs between this node and <code>destNode</code>,
 * and returns the <code>Set</code> of <code>Object</code>s which
 * label those arcs.  If no such arcs exist, returns an empty
 * <code>Set</code>.
 *
 * @param destNode the destination node
 * @return the <code>Set</code> of <code>Object</code>s which
 *         label arcs between this node and <code>destNode</code>
 */
public Set<Class<? extends GrammaticalRelationAnnotation>> arcLabelsToNode(TreeGraphNode destNode) {
  Set<Class<? extends GrammaticalRelationAnnotation>> arcLabels = Generics.newHashSet();
  CyclicCoreLabel cl = label();
  for (Iterator<Class<?>> it = cl.keySet().iterator(); it.hasNext();) {
    Class<? extends CoreAnnotation> key = (Class<? extends CoreAnnotation>) it.next();//javac doesn't compile properly if generics are fully specified (but eclipse does...)
    Object val = cl.get(key);
    if (val != null && val instanceof Set) {
      if (((Set) val).contains(destNode)) {
        if (key != null) {
          arcLabels.add((Class<? extends GrammaticalRelationAnnotation>) key);
        }
      }
    }
  }
  return arcLabels;
}
 
开发者ID:FabianFriedrich,项目名称:Text2Process,代码行数:27,代码来源:TreeGraphNode.java

示例5: getAllDependents

import edu.stanford.nlp.ling.CoreAnnotation; //导入依赖的package包/类
/**
 * Returns all the dependencies of a certain node.
 *
 * @param node The node to return dependents for
 * @return map of dependencies
 */
private static Map<Class<? extends CoreAnnotation>, Set<TreeGraphNode>> getAllDependents(TreeGraphNode node) {
  Map<Class<? extends CoreAnnotation>, Set<TreeGraphNode>> newMap = Generics.newHashMap();

  for (Class<?> o : node.label.keySet()) {
    try {
      // The line below will exception unless it's a GrammaticalRelationAnnotation,
      // so the effect is that only the GrammaticalRelationAnnotation things get put into newMap
      o.asSubclass(GrammaticalRelationAnnotation.class);
      newMap.put((Class<? extends CoreAnnotation>) o, (Set<TreeGraphNode>) node.label.get((Class<? extends CoreAnnotation>) o));//javac doesn't compile properly if generics are fully specified (but eclipse does...)
    } catch (Exception e) {
      // ignore a non-GrammaticalRelationAnnotation element
    }
  }
  return newMap;
}
 
开发者ID:FabianFriedrich,项目名称:Text2Process,代码行数:22,代码来源:GrammaticalStructure.java

示例6: requires

import edu.stanford.nlp.ling.CoreAnnotation; //导入依赖的package包/类
/**
 * Returns the set of tasks which this annotator requires in order
 * to perform.  For example, the POS annotator will return
 * "tokenize", "ssplit".
 */
@Override
public Set<Class<? extends CoreAnnotation>> requires() {
    return Collections.unmodifiableSet(new ArraySet<>(Arrays.asList(
            CoreAnnotations.PartOfSpeechAnnotation.class,
            DigiMorphAnnotations.MorphoAnnotation.class,
            CoreAnnotations.TokensAnnotation.class,
            CoreAnnotations.SentencesAnnotation.class
    )));
}
 
开发者ID:dhfbk,项目名称:tint,代码行数:15,代码来源:DigiLemmaAnnotator.java

示例7: requires

import edu.stanford.nlp.ling.CoreAnnotation; //导入依赖的package包/类
/**
 * Returns the set of tasks which this annotator requires in order
 * to perform.  For example, the POS annotator will return
 * "tokenize", "ssplit".
 */
@Override public Set<Class<? extends CoreAnnotation>> requires() {
    return Collections.unmodifiableSet(new ArraySet<>(Arrays.asList(
            CoreAnnotations.LemmaAnnotation.class,
            DigiMorphAnnotations.MorphoAnnotation.class
    )));
}
 
开发者ID:dhfbk,项目名称:tint,代码行数:12,代码来源:DigiCompMorphAnnotator.java

示例8: requires

import edu.stanford.nlp.ling.CoreAnnotation; //导入依赖的package包/类
/**
 * Returns the set of tasks which this annotator requires in order
 * to perform.  For example, the POS annotator will return
 * "tokenize", "ssplit".
 */
@Override public Set<Class<? extends CoreAnnotation>> requires() {
    return Collections.unmodifiableSet(new ArraySet<>(Arrays.asList(
            CoreAnnotations.TokensAnnotation.class,
            CoreAnnotations.SentencesAnnotation.class
    )));
}
 
开发者ID:dhfbk,项目名称:tint,代码行数:12,代码来源:DigiMorphAnnotator.java

示例9: requires

import edu.stanford.nlp.ling.CoreAnnotation; //导入依赖的package包/类
/**
 * Returns the set of tasks which this annotator requires in order
 * to perform.  For example, the POS annotator will return
 * "tokenize", "ssplit".
 */
@Override public Set<Class<? extends CoreAnnotation>> requires() {
    return Collections.unmodifiableSet(new ArraySet<>(Arrays.asList(
            CoreAnnotations.PartOfSpeechAnnotation.class,
            CoreAnnotations.LemmaAnnotation.class,
            CoreAnnotations.TokensAnnotation.class,
            CoreAnnotations.SentencesAnnotation.class
    )));
}
 
开发者ID:dhfbk,项目名称:tint,代码行数:14,代码来源:VerbAnnotator.java

示例10: requires

import edu.stanford.nlp.ling.CoreAnnotation; //导入依赖的package包/类
/**
 * Returns the set of tasks which this annotator requires in order
 * to perform.  For example, the POS annotator will return
 * "tokenize", "ssplit".
 */
@Override public Set<Class<? extends CoreAnnotation>> requires() {
    return Collections.unmodifiableSet(new ArraySet<>(Arrays.asList(
            CoreAnnotations.PartOfSpeechAnnotation.class,
            CoreAnnotations.TokensAnnotation.class,
            CoreAnnotations.LemmaAnnotation.class,
            CoreAnnotations.SentencesAnnotation.class
    )));
}
 
开发者ID:dhfbk,项目名称:tint,代码行数:14,代码来源:ReadabilityAnnotator.java

示例11: requires

import edu.stanford.nlp.ling.CoreAnnotation; //导入依赖的package包/类
@Override
public Set<Class<? extends CoreAnnotation>> requires() {
    return Collections.unmodifiableSet(new ArraySet<>(Arrays.asList(
            CoreAnnotations.PartOfSpeechAnnotation.class,
            CoreAnnotations.TokensAnnotation.class
    )));
}
 
开发者ID:dhfbk,项目名称:tint,代码行数:8,代码来源:UPosAnnotator.java

示例12: requirementsSatisfied

import edu.stanford.nlp.ling.CoreAnnotation; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public Set<Class<? extends CoreAnnotation>> requirementsSatisfied() {
    Set<Class<? extends CoreAnnotation>> requirements = new HashSet<>(Arrays.asList(
            CoreAnnotations.MentionsAnnotation.class,
            CoreAnnotations.KBPTriplesAnnotation.class
    ));
    return Collections.unmodifiableSet(requirements);
}
 
开发者ID:intel-analytics,项目名称:InformationExtraction,代码行数:12,代码来源:IntelKBPAnnotator.java

示例13: getDep

import edu.stanford.nlp.ling.CoreAnnotation; //导入依赖的package包/类
/** Look through the tree t and adds to the List basicDep dependencies
 *  which aren't in it but which satisfy the filter f.
 *
 * @param t The tree to examine (not changed)
 * @param basicDep The list of dependencies which may be augmented
 * @param f Additional dependencies are added only if they pass this filter
 */
private static void getDep(TreeGraphNode t, List<TypedDependency> basicDep,
                           Filter<TypedDependency> f) {
  if (t.numChildren() > 0) {          // don't do leaves
    Map<Class<? extends CoreAnnotation>, Set<TreeGraphNode>> depMap = getAllDependents(t);
    for (Class<? extends CoreAnnotation> depName : depMap.keySet()) {
      for (TreeGraphNode depNode : depMap.get(depName)) {
        TreeGraphNode gov = t.headWordNode();
        TreeGraphNode dep = depNode.headWordNode();
        if (gov != dep) {
          List<GrammaticalRelation> rels = getListGrammaticalRelation(t, depNode);
          if (!rels.isEmpty()) {
            for (GrammaticalRelation rel : rels) {
              TypedDependency newDep = new TypedDependency(rel, gov, dep);
              if (!basicDep.contains(newDep) && f.accept(newDep)) {
                newDep.setExtra();
                basicDep.add(newDep);
              }
            }
          }
        }
      }
    }
    // now recurse into children
    for (Tree kid : t.children()) {
      getDep((TreeGraphNode) kid, basicDep, f);
    }
  }
}
 
开发者ID:FabianFriedrich,项目名称:Text2Process,代码行数:36,代码来源:GrammaticalStructure.java

示例14: classifyKBest

import edu.stanford.nlp.ling.CoreAnnotation; //导入依赖的package包/类
public Counter<List<IN>> classifyKBest(List<IN> doc, Class<? extends CoreAnnotation<String>> answerField, int k) {

    if (doc.isEmpty()) {
      return new ClassicCounter<List<IN>>();
    }

    // TODO get rid of ObjectBankWrapper
    // i'm sorry that this is so hideous - JRF
    ObjectBankWrapper<IN> obw = new ObjectBankWrapper<IN>(flags, null, knownLCWords);
    doc = obw.processDocument(doc);

    SequenceModel model = getSequenceModel(doc);

    KBestSequenceFinder tagInference = new KBestSequenceFinder();
    Counter<int[]> bestSequences = tagInference.kBestSequences(model, k);

    Counter<List<IN>> kBest = new ClassicCounter<List<IN>>();

    for (int[] seq : bestSequences.keySet()) {
      List<IN> kth = new ArrayList<IN>();
      int pos = model.leftWindow();
      for (IN fi : doc) {
        IN newFL = tokenFactory.makeToken(fi);
        String guess = classIndex.get(seq[pos]);
        fi.remove(CoreAnnotations.AnswerAnnotation.class); // because fake answers will get
                                           // added during testing
        newFL.set(answerField, guess);
        pos++;
        kth.add(newFL);
      }
      kBest.setCount(kth, bestSequences.getCount(seq));
    }

    return kBest;
  }
 
开发者ID:paulirwin,项目名称:Stanford.NER.Net,代码行数:36,代码来源:AbstractSequenceClassifier.java

示例15: getViterbiSearchGraph

import edu.stanford.nlp.ling.CoreAnnotation; //导入依赖的package包/类
public DFSA<String, Integer> getViterbiSearchGraph(List<IN> doc, Class<? extends CoreAnnotation<String>> answerField) {
  if (doc.isEmpty()) {
    return new DFSA<String, Integer>(null);
  }
  // TODO get rid of objectbankwrapper
  ObjectBankWrapper<IN> obw = new ObjectBankWrapper<IN>(flags, null, knownLCWords);
  doc = obw.processDocument(doc);
  SequenceModel model = getSequenceModel(doc);
  return ViterbiSearchGraphBuilder.getGraph(model, classIndex);
}
 
开发者ID:paulirwin,项目名称:Stanford.NER.Net,代码行数:11,代码来源:AbstractSequenceClassifier.java


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