/// <summary> /// Checks if dictionary contains the term entry. /// </summary> /// <param name="term">term word</param> /// <returns>returns true if dictionary contains termEntry, false otherwise</returns> public bool ContainsTermEntry(string term) { if (term == null) { throw new ArgumentException("The term cannot be null"); } return(Terms.ContainsKey(term)); }
public double this[int index] { get { var term = new Term(index); return(Terms.ContainsKey(term) ? Terms[term] : 0); } set { Terms[new Term(index)] = value; } }
public List <TimeInVid> SearchWord(string term) { term = term.ToLower(); if (Terms.ContainsKey(term)) { return(Terms[term]); } return(new List <TimeInVid>()); }
/// <summary> /// Allows to add a new term entry to the dictionary index. /// </summary> /// <param name="termEntry">term entry to be added</param> private void AddTermEntry(TLTermEntry termEntry) { if (Terms.ContainsKey(termEntry.Term)) { throw new ArgumentException("The dictionary already contains that term"); } Terms.Add(termEntry.Term, termEntry); m_termEntries.Add(termEntry); }
/// <summary> /// Adds the specified key/value pair to replace in the template on ToString(). /// </summary> /// <param name="key">The key.</param> /// <param name="value">The value.</param> public void Add(string key, string value) { if (!Terms.ContainsKey(key)) { Terms.Add(key, value); } else { Terms[key] = value; } }
/// <summary> /// Allows to add the new term entry to the dictionary index. /// </summary> /// <param name="term">term word</param> /// <param name="numberOfArtifactsContainingTerm">number of all artifacts of each text contain given term</param> /// <param name="totalFrequencyAcrossAllArtifacts">total frequency across all artifacts</param> /// <param name="weight">weight for the given term</param> /// <returns>just created term entry</returns> public TLTermEntry AddTermEntry(string term, int numberOfArtifactsContainingTerm, int totalFrequencyAcrossAllArtifacts, double weight) { // Integrity checks if (Terms.ContainsKey(term)) { throw new ArgumentException("The dictionary already contains that term"); } TLTermEntry termEntry = new TLTermEntry(term, numberOfArtifactsContainingTerm, totalFrequencyAcrossAllArtifacts, weight); Terms.Add(term, termEntry); m_termEntries.Add(termEntry); return(termEntry); }
/// <summary> /// This will check if the key already exist in the collection. If it does not, then it will add it, else it will increment the frequency by 1 /// </summary> /// <param name="term">The term to add or increment in the dictionary</param> /// <param name="position">The location of the word in the document</param> private void Add(string term, int position) { if (!Terms.ContainsKey(term)) { Terms.Add(term, new List <int>() { position }); } else { Terms[term].Add(position); } MainIndex.Add(term, Document.Name); }
public double this[Term index] { get { return(Terms.ContainsKey(index) ? Terms[index] : 0); } set { Terms[index] = value; } }