Пример #1
0
        public async Task <ActionResult <AnomalyResult> > Process([FromBody] TextRequest request)
        {
            if (request.Text.Length <= 0)
            {
                return(StatusCode(500, "No text data"));
            }

            var documents = await extractor.Extract(request.Header.Domain, request.Text).ConfigureAwait(false);

            var result = await anomalyDetection.RemoveAnomaly(request.Header, documents).ConfigureAwait(false);

            var rating = RatingData.Accumulate(result.Sentences.Select(item => item.CalculateSentiment()));

            return(Ok(new AnomalyResult {
                Document = result, Sentiment = rating.RawRating
            }));
        }
Пример #2
0
        public async Task <ActionResult <AnomalyResult> > Process([FromBody] FileRequest request)
        {
            if (request.FileData.Data.Length <= 0)
            {
                return(StatusCode(500, "No file data"));
            }

            var parsingResult = await documentParser.Parse(request.FileData.Name, request.FileData.Data, CancellationToken.None).ConfigureAwait(false);

            var documents = await extractor.Extract(request.Header.Domain, parsingResult.Document).ConfigureAwait(false);

            var result = await anomalyDetection.RemoveAnomaly(request.Header, documents).ConfigureAwait(false);

            var rating = RatingData.Accumulate(result.Sentences.Select(item => item.CalculateSentiment()));

            return(Ok(new AnomalyResult {
                Document = result, Sentiment = rating.RawRating
            }));
        }
Пример #3
0
 public RatingData CalculateRawRating()
 {
     return(RatingData.Accumulate(allSentences.Select(item => item.CalculateRating())));
 }