Beispiel #1
0
        private void 快速测试F5ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            //string site = "http://news.ifeng.com/mil/taiwan/200807/0718_1569_661217.shtml";

            //HtmlContent hc = new HtmlContent(site);

            MessageBox.Show(JWordSegmentorService.IsExist("互联网").ToString());

            //MessageBox.Show(JWordSegmentorService.GetFrequency("芦侃").ToString());



            //Uri uri = new Uri("http://www.spiffycorners.com/sc.php? sc=my & bg=000000 & fg=ffffff ");

            //string key = @"www.spiffycorners.com/sc.php?scbgfg";

            //WebRule wr = new WebRule(uri);

            //this.propertyGrid.SelectedObject = wr;

            //WebRuleCollection wrc = new WebRuleCollection(uri);
            //for (int i = 0; i < wrc.Count; i++)
            //{
            //    WebRule r = wrc[i];
            //    string md5 = r.ToString();
            //}


            //JDictionaryFileManager filemgr = new JDictionaryFileManager();
            //filemgr.Load(JDictionaryTypeEnum.ChannelDictionary, @"testtest\index.xml");
            //filemgr.AddDictFile(i.ToString(), (i-1).ToString());
            //filemgr.Save();
            //i++;
            //this.propertyGrid.SelectedObject = filemgr;
        }
Beispiel #2
0
        /// <summary>
        /// 合并词库中已有词汇
        /// </summary>
        public void MergeExistWords()
        {
            Dictionary <string, ulong> existNewwords = new Dictionary <string, ulong>();

            // 将词库中已有词库记录并在新词中删除
            foreach (KeyValuePair <string, ulong> word in NewWords)
            {
                if (JWordSegmentorService.IsExist(word.Key))
                {
                    existNewwords.Add(word.Key, JWordSegmentorService.GetFrequency(word.Key) + word.Value);
                }
            }
            foreach (KeyValuePair <string, ulong> word in existNewwords)
            {
                if (NewWords.ContainsKey(word.Key))
                {
                    NewWords.Remove(word.Key);
                }
            }
            // 将已存词存入已在词库属性中
            foreach (var word in existNewwords)
            {
                if (ExistWords.ContainsKey(word.Key))
                {
                    ExistWords[word.Key] += word.Value;
                }
                else
                {
                    ExistWords.Add(word.Key, word.Value);
                }
            }
        }
Beispiel #3
0
 /// <summary>
 /// 初始化的核心方法
 /// </summary>
 internal static void Initialize()
 {
     ///初始资源文件的使用环境
     ResourcesReader.InitializeResources(Service.PathService.Directory.ConfigLanguage, null);
     //Service.Logger.Log(.Add(new Log(LogType.Information,"初始资源文件的使用环境"));
     ///初始软件选项
     Service.Option.InitializeOption(Service.PathService.File.OptionFile);
     ///初始化一个供全局使用的分词类型对象(WordSeg)
     Service.JWordSegmentor = JWordSegmentorService.Creator(
         Service.PathService.Directory.Config,
         Service.PathService.Directory.SegData);
     ///初始化数据库服务
     Service.DbHelper = DbHelper.Creator(Service.PathService.File.SqlXml);
 }
 /// <summary>
 /// 初始Jeelu分词组件的工作环境
 /// </summary>
 internal static void InitializeWords()
 {
     ///初始Jeelu分词组件的工作环境
     Service.JWordSegmentor = JWordSegmentorService.Creator(Service.Path.Directory.Config, Service.Path.Directory.SegData);
 }
Beispiel #5
0
 public Demo()
 {
     InitializeComponent();
     _JWordSegmentor = JWordSegmentorService.Creator("", @"D:\Jeelu\Demo\BillboardQuickDemo\bin\Debug\segdata\");
 }
Beispiel #6
0
 /// <summary>
 /// 判断关键词是否存在于新词和词库中
 /// </summary>
 /// <param name="word"></param>
 /// <returns></returns>
 public bool IsWordExist(string word)
 {
     return(NewWords.ContainsKey(word) || ExistWords.ContainsKey(word) || JWordSegmentorService.IsExist(word, ""));
 }
Beispiel #7
0
 /// <summary>
 /// 词库初始化
 /// </summary>
 private void Init()
 {
     this.JWordSegmentor = JWordSegmentorService.Creator("", @"segdata\");
 }