Example #1
0
        static void Main(string[] args)
        {
            ClassLabelDictionary classLabelDict = new ClassLabelDictionary();
            classLabelDict.LoadFromDB();

            WordDictionary wordDict = new WordDictionary();
            wordDict.LoadFromDB();

            TFIDFDictionary tfidfDict = new TFIDFDictionary();
            tfidfDict.LoadFromDB();

            BoWModelDB docDB = new BoWModelDB(wordDict);
            docDB.LoadFromDBByDataSet("doc_set_cls_1000");

            PModel.PrecedenceModel pModel = new PModel.PrecedenceModel(tfidfDict, classLabelDict);
            pModel.DiscoverPrecedence();

            PrecedenceQuery pQuery = new PrecedenceQuery(pModel, wordDict, classLabelDict);
            pQuery.TestQuery(docDB);
        }
Example #2
0
        static void InitAP()
        {
            wordDict = new WordDictionary();
            docModelDB = new LDABoWModelDB(10, wordDict);

            string line;
            StreamReader reader = new StreamReader(new FileStream("ap.dat", FileMode.Open));
            while ((line = reader.ReadLine()) != null)
            {
                string[] ss = line.Split(' ');
                LDABoWModel doc = new LDABoWModel(docModelDB);
                for (int i = 1; i < ss.Length; i++)
                {
                    string[] sss = ss[i].Split(':');
                    doc.AddWord(int.Parse(sss[0]), int.Parse(sss[1]));
                    wordDict.AddValue(sss[0], int.Parse(sss[0]));
                }
                doc.InitIndex();
                docModelDB.AddDocModel(doc);
            }
            reader.Close();
            docModelDB.Init();
        }
Example #3
0
        static void InitDict()
        {
            classLabelDict = new ClassLabelDictionary();
            classLabelDict.LoadFromDB();

            wordDict = new WordDictionary();
            wordDict.LoadFromDB();
        }