Exemple #1
0
        /// <summary>
        /// 获取分词结果
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        public static Dictionary <string, int> GetResult(string input, string mode = "", bool checkRepetitiveWord = false)
        {
            Dictionary <string, int> res = new Dictionary <string, int>();

            var segmenter = new JiebaSegmenter();

            var words = segmenter.Cut(input);

            var wordDict = new Dictionary <string, int>();

            foreach (var word in words)
            {
                if (2 <= word.Length && StringChecker.IsHanZi(word) || StringChecker.IsEnglish(word))
                {
                    wordDict[word] = 0;
                }
            }

            res = FenCi.GetRepetitiveWordCount(input, wordDict);

            return(res);
        }