Example #1
0
 /// <summary>
 /// method to add a term to the dictionary of terms
 /// </summary>
 /// <param name="DOCNO">the id of current document</param>
 /// <param name="current">the value of current term</param>
 public void AddNewTerm(string DOCNO, string current)
 {
     if (m_allTerms.ContainsKey(current))
     {
         if (m_allTerms[current].m_Terms.ContainsKey(DOCNO))
         {
             m_allTerms[current].m_Terms[DOCNO].AddNewIndex(countPos);
         }
         else
         {
             m_allTerms[current].m_Terms.Add(DOCNO, new Term(current, DOCNO, countPos));
             tmpDoc.m_uniqueCounter++;
         }
         countPos++;
     }
     else
     {
         DocumentsTerm documentTerms = new DocumentsTerm(current);
         documentTerms.AddToDocumentDictionary(new Term(current, DOCNO, countPos));
         m_allTerms.Add(current, documentTerms);
         tmpDoc.m_uniqueCounter++;
         countPos++;
     }
     if (m_allTerms[current].m_Terms[DOCNO].m_tf > _MAX_TF)
     {
         _MAX_TF = m_allTerms[current].m_Terms[DOCNO].m_tf;
     }
 }
Example #2
0
        /// <summary>
        /// method to add a lower case term to the dictionary of terms
        /// </summary>
        /// <param name="DOCNO">the id of current document</param>
        /// <param name="current">the value of current term</param>
        public void AddNewLowerCaseTerm(string DOCNO, string current)
        {
            string lower, upper;

            if (m_allTerms.ContainsKey(lower = current.ToLower()))
            {
                if (m_allTerms[lower].m_Terms.ContainsKey(DOCNO))
                {
                    m_allTerms[lower].m_Terms[DOCNO].AddNewIndex(countPos);
                }
                else
                {
                    m_allTerms[lower].m_Terms.Add(DOCNO, new Term(lower, DOCNO, countPos));
                    tmpDoc.m_uniqueCounter++;
                }
                countPos++;
            }
            else if (m_allTerms.ContainsKey(upper = current.ToUpper()))
            {
                if (m_allTerms[upper].m_Terms.ContainsKey(DOCNO))
                {
                    m_allTerms[upper].m_Terms[DOCNO].AddNewIndex(countPos);
                    m_Entities.Remove(upper);
                }
                else
                {
                    m_allTerms[upper].m_Terms.Add(DOCNO, new Term(upper, DOCNO, countPos));
                    tmpDoc.m_uniqueCounter++;
                }
                DocumentsTerm tmpDocumentTerms = m_allTerms[upper];
                tmpDocumentTerms.m_valueOfTerm = lower;
                m_allTerms.Remove(upper);
                m_allTerms.Add(lower, tmpDocumentTerms);
                countPos++;
            }
            else
            {
                DocumentsTerm documentTerms = new DocumentsTerm(lower);
                documentTerms.AddToDocumentDictionary(new Term(lower, DOCNO, countPos));
                m_allTerms.Add(lower, documentTerms);
                tmpDoc.m_uniqueCounter++;
                countPos++;
            }
            if (m_allTerms[lower].m_Terms[DOCNO].m_tf > _MAX_TF)
            {
                _MAX_TF = m_allTerms[lower].m_Terms[DOCNO].m_tf;
            }
        }
Example #3
0
        /// <summary>
        /// method to add an upper case term to the dictionary of terms
        /// </summary>
        /// <param name="DOCNO">the id of current document</param>
        /// <param name="current">the value of current term</param>
        public void AddNewUpperCaseTerm(string DOCNO, string lower)
        {
            string upper;

            if (m_allTerms.ContainsKey(lower))
            {
                if (m_allTerms[lower].m_Terms.ContainsKey(DOCNO))
                {
                    m_allTerms[lower].m_Terms[DOCNO].AddNewIndex(countPos);
                }
                else
                {
                    m_allTerms[lower].m_Terms.Add(DOCNO, new Term(lower, DOCNO, countPos));
                    tmpDoc.m_uniqueCounter++;
                }
                countPos++;
                if (m_allTerms[lower].m_Terms[DOCNO].m_tf > _MAX_TF)
                {
                    _MAX_TF = m_allTerms[lower].m_Terms[DOCNO].m_tf;
                }
            }
            else if (m_allTerms.ContainsKey(upper = lower.ToUpper()))
            {
                if (m_allTerms[upper].m_Terms.ContainsKey(DOCNO))
                {
                    m_allTerms[upper].m_Terms[DOCNO].AddNewIndex(countPos);
                    if (m_Entities.ContainsKey(upper))
                    {
                        m_Entities[upper]++;
                    }
                    else
                    {
                        m_Entities.Add(upper, 1);
                    }
                }
                else
                {
                    m_allTerms[upper].m_Terms.Add(DOCNO, new Term(upper, DOCNO, countPos));
                    tmpDoc.m_uniqueCounter++;
                    m_Entities.Add(upper, 1);
                }
                countPos++;
                if (m_allTerms[upper].m_Terms[DOCNO].m_tf > _MAX_TF)
                {
                    _MAX_TF = m_allTerms[upper].m_Terms[DOCNO].m_tf;
                }
            }
            else
            {
                DocumentsTerm documentTerms = new DocumentsTerm(upper);
                documentTerms.AddToDocumentDictionary(new Term(upper, DOCNO, countPos));
                m_Entities.Add(upper, 1);
                m_allTerms.Add(upper, documentTerms);
                tmpDoc.m_uniqueCounter++;
                countPos++;
                if (m_allTerms[upper].m_Terms[DOCNO].m_tf > _MAX_TF)
                {
                    _MAX_TF = m_allTerms[upper].m_Terms[DOCNO].m_tf;
                }
            }
        }