Exemple #1
0
 public void checkMinMax(webLemmaTerm term)
 {
     minDF  = Math.Min(term.documentFrequency, minDF);
     minDSF = Math.Min(term.documentSetFrequency, minDSF);
     minTF  = Math.Min(term.termFrequency, minTF);
     maxDF  = Math.Max(term.documentFrequency, maxDF);
     maxDSF = Math.Max(term.documentSetFrequency, maxDSF);
     maxTF  = Math.Max(term.termFrequency, maxTF);
 }
        /// <summary>
        /// Resolves single term - returns weight for lemma of this term
        /// </summary>
        /// <param name="term">The term.</param>
        /// <param name="logger">The logger.</param>
        /// <returns></returns>
        public Double ResolveSingleTerm(String term, ILogBuilder logger = null)
        {
            webLemmaTerm lemma = ResolveLemmaForTerm(term, logger);

            if (lemma != null)
            {
                return(0);
            }
            return(lemma.weight);
        }
Exemple #3
0
        /// <summary>
        /// Gets a clone with same absolute frequencies, nominalForm, and other forms
        /// </summary>
        /// <returns></returns>
        public webLemmaTerm GetAbsoluteClone()
        {
            webLemmaTerm output = new webLemmaTerm();

            output.nominalForm          = nominalForm;
            output.otherForms           = otherForms;
            output.otherForms           = otherForms.ToList();
            output.AFreqPoints          = AFreqPoints;
            output.documentFrequency    = documentFrequency;
            output.documentSetFrequency = documentSetFrequency;
            return(output);
        }
        /// <summary>
        /// Gets lemmas that are common between this and specified <c>tableB</c>
        /// </summary>
        /// <param name="tableB">The table b.</param>
        /// <param name="logger">The logger.</param>
        /// <returns></returns>
        public webLemmaTermPairCollection GetMatchingTerms(webLemmaTermTable tableB, ILogBuilder logger = null)
        {
            webLemmaTermPairCollection output = new webLemmaTermPairCollection();
            List <webLemmaTerm>        lemmas = GetList();

            foreach (webLemmaTerm lemma in lemmas)
            {
                webLemmaTerm lemmaB = tableB.ResolveLemmaForTerm(lemma.nominalForm);
                if (lemmaB != null)
                {
                    output.Add(lemma, lemmaB);
                }
            }
            return(output);
        }
        protected void DeployLemma(webLemmaTerm term)
        {
            if (term == null)
            {
                return;
            }
            Boolean doUpdate = true;

            webLemmaTerm existingTerm = ResolveLemmaForTerm(term.name);

            if (existingTerm == null)
            {
                doUpdate = false;
                lock (indexAddLock)
                {
                    if (!index.ContainsKey(term.nominalForm))
                    {
                        index.Add(term.nominalForm, term);
                        foreach (String termOther in term.otherForms)
                        {
                            if (!indexInflections.ContainsKey(termOther))
                            {
                                indexInflections.Add(termOther, term);
                            }
                        }
                    }
                    else
                    {
                        doUpdate     = true;
                        existingTerm = index[term.nominalForm];
                    }
                }
            }

            if (doUpdate)
            {
                if (existingTerm.weight == term.weight)
                {
                }
                else
                {
                    existingTerm.setObjectBySource(term);
                }
            }
        }
 public webLemmaTermPair(webLemmaTerm _entryA, webLemmaTerm _entryB)
 {
     entryA = _entryA;
     entryB = _entryB;
 }
 /// <summary>
 /// Adds the specified term.
 /// </summary>
 /// <param name="term">The term.</param>
 public void Add(webLemmaTerm term)
 {
     DeployLemma(term);
 }
Exemple #8
0
 /// <summary>
 /// Sums absolute values (abs. frequency, document frequency and document set frequency)
 /// </summary>
 /// <param name="b">The b.</param>
 public void AddAbsoluteValues(webLemmaTerm b)
 {
     AFreqPoints          += b.AFreqPoints;
     documentFrequency    += b.documentFrequency;
     documentSetFrequency += b.documentSetFrequency;
 }
 public void Add(webLemmaTerm entryA, webLemmaTerm entryB)
 {
     Add(new webLemmaTermPair(entryA, entryB));
 }