Пример #1
0
 public TextParser(Tokenizer t)
     : base(t)
 {
     this.Voc = new Dictionary<string, int> ();
     //this.InvIndex = new List<IList<int>> ();
     this.Seq = new List<int> ();
 }
Пример #2
0
        public static void Main(string[] args)
        {
            var outname = "db.test";
            if (!File.Exists(outname)) {
                Tokenizer tokenizer = new Tokenizer ('\t', '\n', (char)0x0);
                //Tokenizer tokenizer = new Tokenizer ('/', '\n', (char)0x0);
                Table table = new Table ();
                table.Build (args [0], int.Parse (args [1]), tokenizer, SequenceBuilders.GetSeqXLB_DiffSet64 (16, 31));
                using (var Output = new BinaryWriter(File.Create(outname))) {
                    table.Save (Output);
                }
            }
            {
                Table table = new Table();
                using (var Input = new BinaryReader(File.OpenRead(outname))) {
                    table.Load(Input);

                    for (int i = 0; i < 3; ++i) {
                        var s = table.GetTextRecord(new StringBuilder(), i).ToString();
                        Console.WriteLine("=== record {0}: {1}", i, s);
                    }
                }
            }
        }