Example #1
0
        //检查词性和词语是否一致
        bool CheckType(WordResult sWord, string sType)
        {
            string first;

            first = sWord.Type.Substring(0, 1);
            if (first == sType)
            {
                return true;
            }
            return false;
        }
Example #2
0
 /*
  * Function: CheckSimilarity
  * Description:计算两个词语的相似度
  * Parameters:
  *      WordResult wSource  
  *      WordResult wTarget
  * Return Value:bool
  */
 bool CheckSimilarity(WordResult wSource, WordResult wTarget)
 {//核心算法B,检查相似度,暂时将内容相等节点合并,以后扩展。
     if (wSource == wTarget)
     {//传入的两个词语是同一个,返回false
         return false;
     }
     if ((wSource.IsIgnore == true) || (wTarget.IsIgnore == true))
     {//传入的两个词语有一个被忽略,返回false
         return false;
     }
     if (wSource.Word == wTarget.Word)
     {//传入的两个词语内容完全相等,返回true
         return true;
     }
     return false;//其他内容不相等的有效节点都返回false
 }
Example #3
0
 public kNode(int iNum, WordResult word)    //构造函数:新建
 {
     this.node = new Node(iNum);
     this.strWord = word.Word;
     this.strType = word.Type;
     this.intLine = word.Line;
     this.intPosition = word.Position;
 }