PanGu.Segment.DoSegment C# (CSharp) Method

DoSegment() public method

public DoSegment ( string text ) : ICollection
text string
return ICollection
        public ICollection<WordInfo> DoSegment(string text)
        {
            return DoSegment(text, null, null);
        }

Same methods

Segment::DoSegment ( string text, Match options ) : ICollection
Segment::DoSegment ( string text, Match options, Match parameters ) : ICollection

Usage Example

Example #1
0
        static void Main(string[] args)
        {
            var str = "共产党是世界上最坏的政党,压迫人民,繁重的苛捐杂税,高压统治,反对人权, 自由万岁!";

            Segment.Init();

            var options = PanGu.Setting.PanGuSettings.Config.MatchOptions.Clone();
            var parameters = PanGu.Setting.PanGuSettings.Config.Parameters.Clone();
            options.FilterStopWords = false;

            Segment segment = new Segment();
            var words = segment.DoSegment(str, options, parameters);

            StringBuilder wordsString = new StringBuilder();
            foreach (WordInfo wordInfo in words)
            {
                if (wordInfo == null)
                {
                    continue;
                }
                wordsString.AppendFormat("{0} ", wordInfo.Word);
            }

            str = wordsString.ToString();
            Console.WriteLine(wordsString.ToString());

            var zhlist = PinyinCommon.GetZhDictsList();

            Console.WriteLine(PinyinCommon.GetPinyin(str, zhlist));

            Console.ReadKey();
        }
All Usage Examples Of PanGu.Segment::DoSegment