12345678910111213141516171819202122232425262728293031 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- namespace Ant.Service.Utilities
- {
- /// <summary>
- /// 分词类
- /// </summary>
- public static class WordSpliter
- {
- /// <summary>
- /// 得到分词关键字
- /// </summary>
- /// <param name="key"></param>
- /// <returns></returns>
- public static string GetKeyword(string key, string splitchar)
- {
- Segment seg = new Segment();
- seg.InitWordDics();
- seg.EnablePrefix = true;
- seg.Separator = splitchar;
- return seg.SegmentText(key, false).Trim();
- }
- public static string GetKeyword(string key)
- {
- return GetKeyword(key, " ");
- }
- }
- }
|