Exemple #1
0
 public static void AnalyzeFilesSeparately(IEnumerable <string> filePaths, string outputDir = null)
 {
     foreach (var filePath in filePaths)
     {
         var fileInfo    = new FileInfo(filePath);
         var outFilePath = $"{outputDir ?? fileInfo.DirectoryName}/{fileInfo.Name}_stat.csv";
         var analyzer    = new TextAnalyzer();
         DoAndPrintTime(() =>
         {
             analyzer.AnalyzeFile(filePath);
             analyzer.RemoveLowFrequency((int)(analyzer.Total * MinRate));
             analyzer.Save(outFilePath);
         }, $"Analyze: {filePath}");
     }
 }
Exemple #2
0
        public static void QueryStatistics(string filePath)
        {
            if (!File.Exists(filePath))
            {
                Console.WriteLine("File not exist.");
                return;
            }
            var stat = new TextAnalyzer(filePath);

            while (true)
            {
                Console.Write("Statistics > ");
                var input = Console.ReadLine().Trim();
                int count = stat.GetStringCount(input);
                Console.WriteLine(count);
            }
        }
Exemple #3
0
 // Abstract Method
 public virtual void FromAnalyzer(TextAnalyzer analyzer)
 {
     SourceName = analyzer.SourceName;
 }
Exemple #4
0
 public override void FromAnalyzer(TextAnalyzer stat)
 {
     throw new InvalidOperationException();
 }