Example #1
0
 public MasterDataBL(string path, double confredence, Primitive yiYuan, WordSimilarity yiXiang, List<string> posSentiment, List<string> negSentiment)
 {
     YiYuan = yiYuan;
     YiXiang = yiXiang;
     PosSentiment = posSentiment;
     NegSentiment = negSentiment;
     MasterDatas = new Dictionary<string, MasterData>();
     Path = path;
     Confredence = confredence;
     MasterDataTable = new DataTable();
     MasterDataTable.Columns.Add("id");
     MasterDataTable.Columns.Add("docid");
        // MasterDataTable.Columns.Add("SentenceId");
     MasterDataTable.Columns.Add("word-string");
     //MasterDataTable.Columns.Add("WordOrder");
     MasterDataTable.Columns.Add("confidence-score", typeof(double));
     MasterDataTable.Columns.Add("word-polarity");
     MasterDataTable.Columns.Add("context-string");
 }
        private void btnImportYiXiang_Click(object sender, RoutedEventArgs e)
        {
            IsImportYiXiang = false;
            MessageInit();

            if (IsImportYiYuan)
            {
                YiXiang = new WordSimilarity();
                txtYiXiangMessage.Text = "义项导入中...";
                Application.Current.Dispatcher.Invoke(DispatcherPriority.Background, new ThreadStart(delegate { }));

                YiXiang.Path = txtYiXiangPath.Text;
                YiXiang.loadGlossary();
                YiXiang.primitive = YiYuan;
                if (YiXiang.ALLWORDS.Count > 0)
                {
                    IsImportYiXiang = true;
                    txtYiXiangMessage.Text = "成功导入义项" + YiXiang.ALLWORDS.Count.ToString() + "条";
                    txtYiXiangMessage.Foreground = Brushes.Green;
                }
                else
                {
                    IsImportYiXiang = false;
                    txtYiXiangMessage.Text = "义项尚未导入";
                    txtYiXiangMessage.Foreground = Brushes.Red;
                    MessageFail("义项导入失败,请去日志查看原因");
                }
            }
            else
            {
                MessageFail("请先导入义原表");
            }
        }