//����������ԭ֮��ľ��룬���������ԭ���û�й�ͬ�ڵ㣬���������ǵľ���Ϊ20��
 public int disPrimitive(Primitive p, string primitive1, string primitive2)
 {
     //Primitive p = new Primitive();
     List<int> list1 = p.getparents(primitive1);
     List<int> list2 = p.getparents(primitive2);
     for (int i = 0; i < list1.Count; i++)
     {
         int id1 = list1[i];
         if (list2.Contains(id1))
         {
             int index = list2.IndexOf(id1);
             return index + i;//������ԭ�����ϵĽڵ��·����
         }
     }
     return DEFAULT_PRIMITIVE_DIS;
 }
 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 btnImportYiYuan_Click(object sender, RoutedEventArgs e)
        {
            YiYuan = new Primitive();
            IsImportYiYuan = false;
            MessageInit();

            txtYiYuanMessage.Text = "义原导入中...";
            Application.Current.Dispatcher.Invoke(DispatcherPriority.Background, new ThreadStart(delegate { }));

            YiYuan.Path = txtYiYuanPath.Text;
            YiYuan.loadGlossary();
            if (YiYuan.PRIMITIVESID.Count > 0)
            {
                IsImportYiYuan = true;
                txtYiYuanMessage.Text = "成功导入义原" + YiYuan.ALLPRIMITIVES.Count.ToString() + "条";
                txtYiYuanMessage.Foreground = Brushes.Green;
            }
            else
            {
                IsImportYiYuan = false;
                txtYiYuanMessage.Text = "义原尚未导入";
                txtYiYuanMessage.Foreground = Brushes.Red;
                MessageFail("义原导入失败,请去日志查看原因");
            }
        }
 //�ڲ��Ƚ������ʣ�������Ϊ����ʣ�Ҳ��������ԭ
 private double innerSimWord(Primitive p, string word1, string word2)
 {
     //Primitive p = new Primitive();
     bool isPrimitive1 = p.isPrimitive(word1);
     bool isPrimitive2 = p.isPrimitive(word2);
     //������ԭ
     if (isPrimitive1 && isPrimitive2)
         return simPrimitive(p, word1, word2);
     if (!isPrimitive1 && !isPrimitive2)
     {
         if (word1.Equals(word2))
             return 1;
         else
             return 0;
     }
     // ��ԭ�;���ʵ����ƶ�, Ĭ��Ϊgamma=0.2
     return gamma;
 }
 //����������ԭ֮������ƶ�
 public double simPrimitive(Primitive p, string primitive1, string primitive2)
 {
     int dis = disPrimitive(p, primitive1, primitive2);
     return alpha / (dis + alpha);
 }