引用PanGuDLL 

private string GetWords(string input)
    {
        ICollection<PanGu.WordInfo> words = new Segment().DoSegment(input);
        StringBuilder result = new StringBuilder();

        List<string> list = new List<string>();
        foreach (WordInfo word in words)
        {
            if (word != null && word.Word.Length > 1)
            {
                bool has = false;
                foreach (string w in list)
                {
                    if (string.Compare(w, word.Word, true) == 0)
                    {
                        has = true;
                        break;
                    }
                }
                if (has)
                    continue;

                list.Add(word.Word);
                result.Append(word.Word).Append(",");
            }
        }
        if (result.Length > 0)
            return result.ToString(0, result.Length - 1);
        else
            return string.Empty;
    }

 

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-12
猜你喜欢
  • 2022-12-23
  • 2021-12-20
  • 2021-12-01
  • 2021-12-04
  • 2021-08-02
  • 2021-12-11
相关资源
相似解决方案