コード例 #1
0
 public static ArgPositionType getArgPositionType(DependencyTree tree, int aIdx) {
   Bunsetsu aBun = tree.getBunsetsuFromNodeId(aIdx);
   DependencyNode aBunHeadNode = aBun.getHeadNode();
   if (aIdx == aBunHeadNode.getId()) {
     return ArgPositionType.HEAD;
   } else if (aIdx == aBunHeadNode.getId() - 1) {
     return ArgPositionType.HEAD_LEFT;
   } else if (aIdx == aBunHeadNode.getId() + 1) {
     return ArgPositionType.HEAD_RIGHT;
   } else {
     return ArgPositionType.OTHER;
   }
 }
コード例 #2
0
 public static DepType getDepType(DependencyTree tree, int pIdx, int aIdx) {
   Bunsetsu pBun = tree.getBunsetsuFromNodeId(pIdx);
   Bunsetsu aBun = tree.getBunsetsuFromNodeId(aIdx);
   Bunsetsu pBunHeadBun = tree.getBunsetsuFromId(pBun.getHead());
   Bunsetsu aBunHeadBun = tree.getBunsetsuFromId(aBun.getHead());
   if (pBun.getId() == aBun.getId()) {
     return DepType.SAME_PHRASE;
   } else if (pBun.getId() == aBunHeadBun.getId()) {
     return DepType.DEP;
   } else if (pBunHeadBun.getId() == aBunHeadBun.getId()) {
     return DepType.DEP;
   } else {
     return DepType.ZERO_INTRA;
   }
 }