/// <summary> /// Constructs a hash table. /// </summary> public DiskPositionalIndex(string path) { tempTermFreq = new Dictionary <string, int>(); tokensPerDocument = new Dictionary <int, int>(); docByteSize = new Dictionary <int, int>(); calculatedDocWeights = new Dictionary <int, double>(); averageTermFreqPerDoc = new Dictionary <int, double>(); tempTier1 = new Dictionary <string, List <MaxPriorityQueue.InvertedIndex> >(); tempTier2 = new Dictionary <string, List <MaxPriorityQueue.InvertedIndex> >(); tempTier3 = new Dictionary <string, List <MaxPriorityQueue.InvertedIndex> >(); tier1 = new OnDiskDictionary <string, List <MaxPriorityQueue.InvertedIndex> >(path, "Tier1Index", new StringEncoderDecoder(), new InvertedIndexEncoderDecoder()); tier2 = new OnDiskDictionary <string, List <MaxPriorityQueue.InvertedIndex> >(path, "Tier2Index", new StringEncoderDecoder(), new InvertedIndexEncoderDecoder()); tier3 = new OnDiskDictionary <string, List <MaxPriorityQueue.InvertedIndex> >(path, "Tier3Index", new StringEncoderDecoder(), new InvertedIndexEncoderDecoder()); tempPostingMap = new Dictionary <string, List <Posting> >(); tempDocWeightsHashMap = new Dictionary <int, PostingDocWeight>(); postingMap = new OnDiskDictionary <string, List <Posting> >(path, "InvertedIndex", new StringEncoderDecoder(), new PostingListEncoderDecoder()); docWeigthsHashMap = new OnDiskDictionary <int, PostingDocWeight>(path, "docWeights", new IntEncoderDecoder(), new PostingDocWeightEncoderDecoder()); }
/// <summary> /// Constructor /// </summary> /// <param name="vocabularies">List of unique vocabularies.false Non stem.</param> /// <param name="size">Size of each k-gram term</param> public DiskKGram(string path, int size = 3) { this.size = size; this.path = path; this.tempMap = new Dictionary <string, List <string> >(); this.tempMiniMap = new Dictionary <string, List <string> >(); this.map = new OnDiskDictionary <string, List <string> >(path, "KGram", new StringEncoderDecoder(), new StringListEncoderDecoder()); this.miniMap = new OnDiskDictionary <string, List <string> >(path, "MiniKGram", new StringEncoderDecoder(), new StringListEncoderDecoder()); }
public void TestWriteToDisk() { OnDiskDictionary <string, string> dic = new OnDiskDictionary <string, string>("./", "TestAlphabet", new StringEncoderDecoder(), new StringEncoderDecoder()); dic.Add("A", "Apple"); dic.Add("B", "Banana"); dic.Add("C", "Cat"); dic.Add("D", "Dog"); dic.Add("E", "Eye"); Assert.Equal("Apple", dic.Get("A")); Assert.Equal("Eye", dic.Get("E")); Assert.Equal("Banana", dic.Get("B")); Assert.Equal("Dog", dic.Get("D")); Assert.Equal("Cat", dic.Get("C")); dic.Clear(); }
/// <summary> /// Constructs SoundExIndex with an empty soundMap /// </summary> public DiskSoundEx(string path) { this.path = path; tempMap = new Dictionary <string, List <int> >(); map = new OnDiskDictionary <string, List <int> >(path, "SoundEx", new StringEncoderDecoder(), new IntListEncoderDecoder()); }