Examples of TopTreebankNode


Examples of org.apache.ctakes.typesystem.type.syntax.TopTreebankNode

          while(allMarks.size() > 0){
            // keep going back sentence by sentence
            sentInd--;
            if(sentInd < 0) break;
            TopTreebankNode ttn = (TopTreebankNode) sentList.get(sentInd);
            q = new LinkedList<TreebankNode>();
            q.add(ttn);
            tempList = HobbsTreeNavigator.bfs(q, null, null);
            for(TreebankNode cur : tempList){
              if(node2mark.containsKey(cur)){
View Full Code Here

Examples of org.apache.ctakes.typesystem.type.syntax.TopTreebankNode

  @Override
  public List<Feature> extract(JCas view, Annotation focusAnnotation)
      throws CleartkExtractorException {
    List<Feature> features = new ArrayList<Feature>();
    // first get the root and print it out...
    TopTreebankNode root = AnnotationTreeUtils.getTreeCopy(view, AnnotationTreeUtils.getAnnotationTree(view, focusAnnotation));

    if(root == null){
      SimpleTree fakeTree = new SimpleTree("(S (NN null))");
      features.add(new TreeFeature(FEAT_NAME, fakeTree.toString()));
      return features;
View Full Code Here

Examples of org.apache.ctakes.typesystem.type.syntax.TopTreebankNode

  @Override
  public List<Feature> extract(JCas jcas, IdentifiedAnnotation arg1,
      IdentifiedAnnotation arg2) throws AnalysisEngineProcessException {
    List<Feature> features = new ArrayList<Feature>();
    // first get the root and print it out...
    TopTreebankNode root = AnnotationTreeUtils.getTreeCopy(jcas, AnnotationTreeUtils.getAnnotationTree(jcas, arg1));
    if(root == null){
      SimpleTree fakeTree = new SimpleTree("(S (NN null))");
      features.add(new TreeFeature("TK_PATH", fakeTree.toString()));
      return features;
    }
View Full Code Here

Examples of org.apache.ctakes.typesystem.type.syntax.TopTreebankNode

  @Override
  public List<Feature> extract(JCas jcas, IdentifiedAnnotation arg1,
      IdentifiedAnnotation arg2) throws AnalysisEngineProcessException {
    List<Feature> features = new ArrayList<Feature>();
    // first get the root and print it out...
    TopTreebankNode root = AnnotationTreeUtils.getTreeCopy(jcas, AnnotationTreeUtils.getAnnotationTree(jcas, arg1));
   
    if(root == null){
      SimpleTree fakeTree = new SimpleTree("(S (NN null))");
      features.add(new TreeFeature(FEAT_NAME, fakeTree.toString()));
      return features;
View Full Code Here

Examples of org.apache.ctakes.typesystem.type.syntax.TopTreebankNode

  @Override
  public List<Feature> extract(JCas jcas, IdentifiedAnnotation arg1,
      IdentifiedAnnotation arg2) throws AnalysisEngineProcessException {
    List<Feature> features = new ArrayList<Feature>();
    // first get the root and print it out...
    TopTreebankNode root = AnnotationTreeUtils.getTreeCopy(jcas, AnnotationTreeUtils.getAnnotationTree(jcas, arg1));
   
    if(root == null){
      SimpleTree fakeTree = new SimpleTree("(S (NN null))");
      features.add(new TreeFeature("TK_PET", fakeTree.toString()));
      return features;
View Full Code Here

Examples of org.apache.ctakes.typesystem.type.syntax.TopTreebankNode

    }
    if(parse == null){
      buff.append("(S null)");
    }

    TopTreebankNode ttn = new TopTreebankNode(jcas);
    ttn.setTreebankParse(buff.toString());
    ttn.addToIndexes();
  }
View Full Code Here

Examples of org.apache.ctakes.typesystem.type.syntax.TopTreebankNode

      return getHighestIndexTerm(inTree.getChildren(inTree.getChildren().size()-1));
  }

  public static TopTreebankNode getTopNode(TreebankNode inTree) {
    TreebankNode cur = inTree;
    TopTreebankNode top = null;
   
    while(!(cur instanceof TopTreebankNode)){
      cur = cur.getParent();
    }
    top = (TopTreebankNode) cur;
View Full Code Here

Examples of org.apache.ctakes.typesystem.type.syntax.TopTreebankNode

    FSArray termArray = TreeUtils.getTerminals(jcas, sent);
   
    StringBuffer parseBuff = new StringBuffer();
    if(parse != null) parse.show(parseBuff);
   
    TopTreebankNode top = new TopTreebankNode(jcas, sent.getBegin(), sent.getEnd());
    top.setTreebankParse(parseBuff.toString());
    top.setTerminals(termArray);
    top.setParent(null);
    if(parse != null) recursivelyCreateStructure(jcas, top, parse, top);
 
    return top;
  }
View Full Code Here

Examples of org.apache.ctakes.typesystem.type.syntax.TopTreebankNode

  // Returns Path-enclosed trees of Moschitti 2004 (ACL)
  @Override
  public List<Feature> extract(JCas jcas, IdentifiedAnnotation arg1, IdentifiedAnnotation arg2) throws AnalysisEngineProcessException {
    List<Feature> features = new ArrayList<Feature>();
    // first get the root and print it out...
    TopTreebankNode root = AnnotationTreeUtils.getTreeCopy(jcas, AnnotationTreeUtils.getAnnotationTree(jcas, arg1));
   
//    SimpleTree tempClone = TreeExtractor.getSimpleClone(root);
//    features.add(new Feature("TK_FULL", tempClone.toString()));
    TreebankNode t1 = AnnotationTreeUtils.insertAnnotationNode(jcas, root, arg1, "ARG1");
    TreebankNode t2 = AnnotationTreeUtils.insertAnnotationNode(jcas, root, arg2, "ARG2");
View Full Code Here

Examples of org.apache.ctakes.typesystem.type.syntax.TopTreebankNode

    // add Token, Sentence and TreebankNode annotations for the text
    for (org.cleartk.syntax.constituent.util.TopTreebankNode utilTree : utilTrees) {

      // create a Sentence and set its parse
      TopTreebankNode tree = convert(utilTree, jcas);
      Sentence sentence = new Sentence(jcas, tree.getBegin(), tree.getEnd());
      sentence.addToIndexes();

      // create the Tokens and add them to the Sentence
      for (int i = 0; i < tree.getTerminals().size(); i++) {
        TreebankNode leaf = tree.getTerminals(i);
        if (leaf.getBegin() != leaf.getEnd()) {
          BaseToken token = new BaseToken(jcas, leaf.getBegin(), leaf.getEnd());
          token.setPartOfSpeech(leaf.getNodeType());
          token.addToIndexes();
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.