Exemple #1
0
        public static TfFile Creator(int idDoc, Single tf)
        {
            TfFile ret = new TfFile();

            ret.IdDoc = idDoc;
            ret.Tf    = tf;
            return(ret);
        }
Exemple #2
0
        public List <TfFile> TfFilesForWord(string word)
        {
            int WordId = SearchData.Singelton.wordDic.NumbWord(word);

            if (WordId >= 0)
            {
                Single Idf = SearchData.Singelton.TfIdf.IDFToWord(WordId);
                if (WordId == -1)
                {
                    return(null);
                }
                List <int>    AllDoc = AllDockForWord(WordId);
                List <Single> AllTf  = AllTFForWord(WordId);
                List <TfFile> AllFileTf;
                if (AllDoc == null)
                {
                    return(null);
                }
                if (AllDoc.Count == AllTf.Count)
                {
                    AllFileTf = new List <TfFile>(AllTf.Count);
                    for (int i = 0; i < AllDoc.Count; i++)
                    {
                        AllFileTf.Add(TfFile.Creator(AllDoc[i], BM25(AllTf[i], Idf, 4)));
                    }
                }
                else
                {
                    AllFileTf = new List <TfFile>(0);
                    Console.WriteLine("ErrorRead");
                }
                //PTerm.Add(new TermDockTF(AllDoc));
                return(AllFileTf);
            }
            return(null);
        }