Esempio n. 1
0
        private OneDocumentInvindex StopWordsRemovals(OneDocumentInvindex doc)
        {
            OneDocumentInvindex DocumentUpdated;
            List <string>       documentTerms     = new List <string>();
            List <string>       documentTermsTemp = doc.Terms;

            for (int i = 0; i < documentTermsTemp.Count; i++)
            {
                if (!stop.Contains(documentTermsTemp[i]))
                {
                    documentTerms.Add(documentTermsTemp[i]);
                }
            }
            DocumentUpdated = new OneDocumentInvindex(doc.DocumentId, documentTerms, doc.Frequences, doc.Positions);
            return(DocumentUpdated);
        }
Esempio n. 2
0
 private void SaveInvertedIndex(OneDocumentInvindex doc)
 {
     for (int i = 0; i < doc.Terms.Count(); i++)
     {
         string term = doc.Terms.ElementAt(i);
         conn.Open();
         if (TermInserted(term, "GetTermDetails"))
         {
             UpdateTerm(term, doc.Positions[term], doc.Frequences[term].ToString(), doc.DocumentId.ToString());
         }
         else
         {
             InsertTerm(term, doc.Positions[term], doc.Frequences[term].ToString(), doc.DocumentId.ToString());
         }
         conn.Close();
     }
 }
Esempio n. 3
0
        private void HandlingModule1(object obj)
        {
            Dictionary <int, List <string> > index = (Dictionary <int, List <string> >)obj;

            if (index != null)
            {
                semaphore.WaitOne();
                saveWordToDataBase(index);
                semaphore.Release();
                List <string>               stemmers   = stemWord(index.Values.ElementAt(0));
                Dictionary <string, int>    frequences = Frequences(stemmers);
                Dictionary <string, string> positions  = Positions(stemmers);
                OneDocumentInvindex         doc        = new OneDocumentInvindex(index.Keys.ElementAt(0), stemmers.Distinct().ToList(), frequences, positions);
                semaphore.WaitOne();
                SaveInvertedIndex(StopWordsRemovals(doc));
                semaphore.Release();
            }
        }