Exemple #1
0
 /**
  * 自动构造一个合理的顶点
  *
  * @param realWord
  */
 public Vertex(String realWord) {
   this(null, realWord, CoreDictionary.get(realWord));
 }
Exemple #2
0
  /**
   * 将原词转为等效词串
   *
   * @param realWord 原来的词
   * @param attribute 等效词串
   * @return
   */
  private String compileRealWord(String realWord, CoreDictionary.Attribute attribute) {
    if (attribute.nature.length == 1) {
      switch (attribute.nature[0]) {
        case nr:
        case nr1:
        case nr2:
        case nrf:
        case nrj:
          {
            wordID = CoreDictionary.NR_WORD_ID;
            //                    this.attribute = CoreDictionary.get(CoreDictionary.NR_WORD_ID);
            return Predefine.TAG_PEOPLE;
          }
        case ns:
        case nsf:
          {
            wordID = CoreDictionary.NS_WORD_ID;
            // 在地名识别的时候,希望类似"河镇"的词语保持自己的词性,而不是未##地的词性
            //                    this.attribute = CoreDictionary.get(CoreDictionary.NS_WORD_ID);
            return Predefine.TAG_PLACE;
          }
          //                case nz:
        case nx:
          {
            wordID = CoreDictionary.NX_WORD_ID;
            this.attribute = CoreDictionary.get(CoreDictionary.NX_WORD_ID);
            return Predefine.TAG_PROPER;
          }
        case nt:
        case ntc:
        case ntcf:
        case ntcb:
        case ntch:
        case nto:
        case ntu:
        case nts:
        case nth:
        case nit:
          {
            wordID = CoreDictionary.NT_WORD_ID;
            this.attribute = CoreDictionary.get(CoreDictionary.NT_WORD_ID);
            return Predefine.TAG_GROUP;
          }
        case m:
        case mq:
          {
            wordID = CoreDictionary.M_WORD_ID;
            this.attribute = CoreDictionary.get(CoreDictionary.M_WORD_ID);
            return Predefine.TAG_NUMBER;
          }
        case x:
          {
            wordID = CoreDictionary.X_WORD_ID;
            this.attribute = CoreDictionary.get(CoreDictionary.X_WORD_ID);
            return Predefine.TAG_CLUSTER;
          }
          //                case xx:
          //                case w:
          //                {
          //                    word= Predefine.TAG_OTHER;
          //                }
          //                break;
        case t:
          {
            wordID = CoreDictionary.T_WORD_ID;
            this.attribute = CoreDictionary.get(CoreDictionary.T_WORD_ID);
            return Predefine.TAG_TIME;
          }
      }
    }

    return realWord;
  }