Trainer.java 文件源码

java
阅读 26 收藏 0 点赞 0 评论 0

项目:codebuff 作者:
public static int getMatchingSymbolStartsLine(Corpus corpus,
                                                  InputDocument doc,
                                                  TerminalNode node)
    {
        TerminalNode matchingLeftNode = getMatchingLeftSymbol(corpus, doc, node);
        if ( matchingLeftNode != null ) {
            Token matchingLeftToken = matchingLeftNode.getSymbol();
            int i = matchingLeftToken.getTokenIndex();
            if ( i==0 ) return 1; // first token is considered first on line
            Token tokenBeforeMatchingToken = doc.tokens.getPreviousRealToken(i);
//          System.out.printf("doc=%s node=%s, pair=%s, before=%s\n",
//                            new File(doc.fileName).getName(), node.getSymbol(), matchingLeftToken, tokenBeforeMatchingToken);
            if ( tokenBeforeMatchingToken!=null ) {
                return matchingLeftToken.getLine()>tokenBeforeMatchingToken.getLine() ? 1 : 0;
            }
            else { // matchingLeftToken must be first in file
                return 1;
            }
        }
        return NOT_PAIR;
    }
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号