/**
  * 测试问句是:pe>10 的乱码情况。
  *
  * @author huangmin
  * @throws Exception
  */
 @Test
 public void checkIsMessyCodeTextForPeGreatThan10Test() throws Exception {
   String queryStr = "pe>10";
   for (int i = 0; i < getQueries().size(); i++) {
     ParserAnnotation pAnnotation = createAnnotation(queryStr, false);
     PhraseParserPrePluginAbstract checkIsMessyCodeTextPlugin =
         getPrePluginByName(CHECK_IS_MESSYCODE_TEXT);
     execute(checkIsMessyCodeTextPlugin, true, pAnnotation);
     ArrayList<ArrayList<SemanticNode>> qlist = pAnnotation.getQlist();
     assertResultListNotNull(qlist);
     // TODO: any other assert should be add here.
   }
 }
Ejemplo n.º 2
0
  /**
   * 单分词可能性的分词模块
   *
   * @param query
   */
  private static ArrayList<SemanticNode> tokenize(Query query, String ltpRlt) {
    ArrayList<SemanticNode> nodes = new ArrayList<SemanticNode>();
    if (query.text.length() == 0) return null;
    // new Tokenizer(query).tokenize(new Environment(),ltpRlt);

    ParserAnnotation annotation = new ParserAnnotation();
    annotation.setQueryText(ltpRlt);
    annotation.setQueryType(query.getType());
    annotation.setQuery(query);
    Tokenizer.tokenize(annotation);

    // if (!query.hasFatalError())
    nodes = annotation.getNodes();
    return nodes;
  }
  public ArrayList<ArrayList<SemanticNode>> process(ParserAnnotation annotation) {

    Environment ENV = annotation.getEnv();
    ArrayList<SemanticNode> nodes = annotation.getNodes();
    return bindPropToIndex(nodes, ENV);
  }
  public ArrayList<ArrayList<SemanticNode>> process(ParserAnnotation annotation) {

    Environment ENV = annotation.getEnv();
    ArrayList<SemanticNode> nodes = annotation.getNodes();
    return matchSyntacticPatterns.matchSyntacticPatterns(nodes, ENV);
  }