Beispiel #1
0
        public static PaperAnalysisResult AnalyzePaper(string path, string titles, string paperName, string refsName,
                                                       out long textExtractionTime, out long analyzingTime, out int stringLength)
        {
            var watch         = System.Diagnostics.Stopwatch.StartNew();
            var textExtractor = new PdfTextExtractor(path);

            try
            {
                var text = textExtractor.GetAllText();
                watch.Stop();
                textExtractionTime = watch.ElapsedMilliseconds;
                watch.Restart();
                var result = PaperAnalyzer.PaperAnalyzer.Instance.ProcessTextWithResult(text, titles, paperName, refsName, new ResultScoreSettings());
                watch.Stop();
                analyzingTime = watch.ElapsedMilliseconds;
                stringLength  = text.Length;
                return(result);
            }
            catch (Exception ex)
            {
                var res = new PaperAnalysisResult(new List <Section>(), new List <Criterion>(), new List <AnalyzeResults.Errors.Error>());
                res.Error          = ex.Message;
                textExtractionTime = -1;
                analyzingTime      = -1;
                stringLength       = -1;
                return(res);
            }
        }