Exemple #1
0
 public void Load(BinaryReader Input)
 {
     this.AlphabetBlock = Input.ReadInt32 ();
     Console.WriteLine ("Loading sketch");
     long start_size = Input.BaseStream.Position;
     this.N = Input.ReadInt32 ();
     this.Sketch = new ListSDiff64 ();
     this.Sketch.Load (Input);
     Console.WriteLine ("*** sketch-size-bytes:", Input.BaseStream.Position - start_size);
     start_size = Input.BaseStream.Position;
     Console.WriteLine ("Loading vocabulary");
     int vocabulary_size;
     vocabulary_size = Input.ReadInt32 ();
     this.FreqPerm = new int[vocabulary_size];
     PrimitiveIO<int>.ReadFromFile (Input, vocabulary_size, this.FreqPerm);
     Console.WriteLine ("*** perms-size-bytes:", Input.BaseStream.Position - start_size);
     start_size = Input.BaseStream.Position;
     this.InvIndex = new IRankSelect[vocabulary_size];
     for (int i = 0; i < this.InvIndex.Count; i++) {
         this.InvIndex[i] = RankSelectGenericIO.Load (Input);
     }
     Console.WriteLine ("*** invindex-size-bytes:", Input.BaseStream.Position - start_size);
 }
Exemple #2
0
 public void CreateSketch(IList<IList<int>> invindex, int maxvalue)
 {
     // after PermSortByFreq the invindex is permutated too
     var L = new IList<int>[invindex.Count];
     for (int i = 0; i < L.Length; i++) {
         L [i] = invindex [i];
     }
     this.PermSortByFreq (L, maxvalue);
     this.Sketch = new ListSDiff64 ();
     Console.WriteLine ("Creating sketch of the text");
     Chronos C = new Chronos ();
     C.Start ();
     var S = new InvIndexSketchBuilder (L, this.N);
     S.Build (this.Sketch, this.AlphabetBlock);
     C.End ();
     C.PrintStats ();
 }