예제 #1
0
 public void InsertWord(string key)
 {
     if (key.Length < MINLEN)
     {
         return;
     }
     _words++;
     if (_st.Contains(key))
     {
         _st.Put(key, _st.Get(key) + 1);
     }
     else
     {
         _st.Put(key, 1);
         _distinct++;
     }
 }
예제 #2
0
 public void CreateIndex(string fileName, IEnumerable <string> words)
 {
     foreach (var word in words)
     {
         if (!_st.Contains(word))
         {
             _st.Put(word, new SET <string>());
         }
         var set = _st.Get(word);
         set.Add(fileName);
     }
 }
예제 #3
0
 /// <summary>
 /// Sets the ith coordinate of this vector to the specified value.
 /// </summary>
 /// <param name="i">i the index</param>
 /// <param name="value">value the new value</param>
 /// <exception cref="IndexOutOfRangeException">unless i is between 0 and d-1</exception>
 public void Put(int i, double value)
 {
     if (i < 0 || i >= _dims)
     {
         throw new IndexOutOfRangeException("Illegal index");
     }
     if (Math.Abs(value) < 0.0001)
     {
         _st.Delete(i);
     }
     else
     {
         _st.Put(i, value);
     }
 }
예제 #4
0
 public void CreateLookup(string key, IEnumerable <string> values)
 {
     foreach (var value in values)
     {
         if (!_st.Contains(key))
         {
             _st.Put(key, new Collections.Queue <string>());
         }
         if (!_ts.Contains(value))
         {
             _ts.Put(value, new Collections.Queue <string>());
         }
         _st.Get(key).Enqueue(value);
         _ts.Get(value).Enqueue(key);
     }
 }
예제 #5
0
 public void InsertItem(string key, string value)
 {
     _st.Put(key, value);
 }