示例#1
0
        //��ȡһ����ԭ�����и���ԭ��ֱ������λ��
        public List<int> getparents(string primitive)
        {
            List<int> list = new List<int>();
            //��ȡ�����ԭ��ID
            try
            {
                int id = PRIMITIVESID[primitive];
                //���������ԭ��ID
                if (id >= 0)
                {
                    list.Add(id);//������ԭ��ID--���仰˵��������������ԭID����
                    Primitive parent = ALLPRIMITIVES[id];//��ȡ��ԭ�ĸ�����ԭ
                    while (!parent.isTop())//�ж��Ƿ�Ϊ����Ľڵ�
                    {
                        list.Add(parent.getParentId());
                        parent = ALLPRIMITIVES[parent.getParentId()];

                    }
                }
            }
            catch (Exception ex)
            {
            }

            //�����𼶴�����Ľڵ��ID����Ҷ�ӽڵ㵽���ڵ㡣
            return list;
        }
示例#2
0
 //��ӹ�ϵ��ԭ
 //�����ϵ��ԭ��key��Ӧ��ListΪ�գ����½�һ��������value��
 //���򣬾�ֱ���ڹ�ϵ��ԭ��key��Ӧ��List����ֱ������value��
 public void addRelationalPrimitive(string key, string value)
 {
     List<string> list = null;
     if (relationalPrimitives.ContainsKey(key))
     {
         list = relationalPrimitives[key];
         list.Add(value);
     }
     else {
         list = new List<string>();
         list.Add(value);
         relationalPrimitives.Add(key, list);
     }
 }
 //����һ������
 public void addWord(Word word)
 {
     if (ALLWORDS.ContainsKey(word.getWord()))
     {
         List<Word> list = ALLWORDS[word.getWord()];
         list.Add(word);
     }
     else
     {
         List<Word> list = new List<Word>();
         list.Add(word);
         ALLWORDS.Add(word.getWord(), list);
     }
 }
示例#4
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");
 }
示例#5
0
 public static List<Budjet> GetBudget()
 {
     List<Budjet> bdjs = new List<Budjet>();
     using (StreamReader reader = new StreamReader("Data.txt"))
     {
         string line = reader.ReadLine();
         do
         {
             string[] currentbdj = line.Split('|');
             bdjs.Add(new Budjet()
             {
                 Data = currentbdj[0],
                 Costs = currentbdj[1],
                 Prize = int.Parse(currentbdj[2]),
             });
             line = reader.ReadLine();
         } while (line != null);
     }
     return bdjs;
 }
示例#6
0
 //���ýṹ��ԭ
 public void setStructruralWords(List<string> structruralWords)
 {
     this.structruralWords = structruralWords;
 }
示例#7
0
 //����������ԭ
 public void setOtherPrimitives(List<string> otherPrimitives)
 {
     this.otherPrimitives = otherPrimitives;
 }
示例#8
0
文件: Program.cs 项目: GarageInc/all
        //Автоматизированная работа.
        public static void Visualization(List Students)
        {

            //Печатаем
            Students.Print();
            Console.WriteLine();
            //Удаляем студентов с возрастом меньше 18

            while (Students.headNode!=null && Students.headNode.student.old<18)
            {
                Students.headNode=Students.headNode.next;
            }
            //Тут взяли студента старше 18 лет
            Node temp2 = Students.headNode;
         
            while (temp2.next != null)
            {
                bool per=false;
                if (temp2.next.student.old < 18)
                {
                    per = true;
                    temp2.next = temp2.next.next;
                }; ;

                if(!per)
                    temp2 = temp2.next;

            }

            //Результат
            Students.Print();
            Console.WriteLine();

            //Разбиваем на две пары
            List M = new List();
            List W = new List();
            Node temp = Students.headNode;
            while (temp != null)
            {
                if (temp.student.pol.CompareTo("m") == 0)
                    M.Push(temp.student);
                else
                    W.Push(temp.student);

                temp = temp.next;
            }
            
            //Результаты деления
            M.Print();
            Console.WriteLine();
            W.Print();
            Console.WriteLine();

        }
示例#9
0
文件: Program.cs 项目: GarageInc/all
        static void Main(string[] args)
        {
            //Создаем список
            List Students = new List();

            //Добавляем в список слова из файла
            //Создаем поток для чтения
            StreamReader sr = new StreamReader("students.txt", Encoding.GetEncoding(1251));

            //Считываем из файла, пока он не закончится
            while (!sr.EndOfStream)
            {
                string[] s = sr.ReadLine().Split(' ');//Вся строка - разбивается на массив из трех элементов
                Student el=new Student(s[0], s[1], s[2]);//Добавляем в Студента теста
                //Закидываем в список
                Students.Push(el);
            }
        //    Students.Print();
            //Запускаем функцию визуализации работы
            Visualization(Students);

            Console.ReadKey();
        }
示例#10
0
        //�������
        //�Ƚ��������ϵ����ƶ�
        public double simList(List<string> list1, List<string> list2)
        {
            if (list1.Count == 0 && list2.Count == 0)
                return 1;
            int m = list1.Count;//��һ���б�ĸ���
            int n = list2.Count;//�ڶ����б�ĸ���
            int big = m > n ? m : n;//�ϴ��
            int N = (m < n) ? m : n;//����
            int count = 0;
            int index1 = 0, index2 = 0;//����
            double sum = 0;
            double max = 0;
            while (count < N)
            {
                max = 0;
                for (int i = 0; i < list1.Count; i++)
                {
                    for (int j = 0; j < list2.Count; j++)
                    {
                        //����������ԭ�����ƶȣ��ҵ�������ƶȵĽ�����ԡ�
                        //�������ԭ���ͼ�����ԭ�ľ���
                        //����Ǿ���ʣ���ͬΪ1����ͬΪ0��
                        double sim = innerSimWord(primitive, list1[i], list2[j]);
                        if (sim > max)
                        {
                            index1 = i;
                            index2 = j;
                            max = sim;
                        }
                    }

                }
                //�ۼ�ֵ����
                sum += max;
                //�Ƴ���Գɹ�������
                list1.RemoveAt(index1);
                list2.RemoveAt(index2);
                count++;//��Գɹ��ĸ�����--��ʵ�϶���N���������������Сֵ��
            }
            return (sum + delta * (big - N)) / big;
        }