public void AddFiles(string[] input, VectorTree tree) { ClearFiles(input, tree); foreach (var file in Directory.GetFiles(input[1], input[2])) { var n = AddFile(file, tree); Console.Write("{0} {1} ", file, n); } Console.WriteLine(tree.Visualize(0, 0)); var size = tree.Size(0, 0); Console.WriteLine(); Console.WriteLine("depth {0} width {1} count: {2}, merges: {3}", size.depth, size.width, tree.Count, tree.MergeCount); using (var treeStream = File.Create("tree.bin")) using (var wordStream = File.Create("word.bin")) using (var posStream = File.Create("pos.bin")) { tree.GetNode(0, 0).Serialize(treeStream, wordStream, posStream); } //using (var treeStream = File.OpenRead("tree.bin")) //using (var wordStream = File.OpenRead("word.bin")) //{ // var deserialized = VectorTree.Load(treeStream, wordStream); // Console.WriteLine(deserialized.Visualize()); // var deserializedSize = deserialized.Size(); // Console.WriteLine("depth {0} width {1}", deserializedSize.depth, deserializedSize.width); //} }
public void Add(string[] input, VectorTree tree) { Add(input.Skip(1).ToArray(), tree); Console.WriteLine(tree.Visualize(0, 0)); var size = tree.Size(0, 0); Console.WriteLine(); Console.WriteLine("depth {0} width {1}", size.depth, size.width); }
public void AddWebPage(string[] input, VectorTree tree) { AddWebPage(input[1], tree); Console.WriteLine(tree.Visualize(0, 0)); Console.WriteLine("count: {0}", tree.Count); Console.WriteLine("merges: {0}", tree.MergeCount); var size = tree.Size(0, 0); Console.WriteLine("depth {0} width {1}", size.depth, size.width); }
private void AddWebPage(string url, VectorTree tree) { var text = GetWebResource(url); AddDocument(url, Tokenize(text), tree); Console.WriteLine(tree.Visualize(0, 0)); var size = tree.Size(0, 0); Console.WriteLine(); Console.WriteLine("depth {0} width {1}", size.depth, size.width); }