Ejemplo n.º 1
0
        private async Task <ProcessingContext> ProcessSingleRequest(SingleWorkRequest request)
        {
            if (request == null)
            {
                throw new ArgumentNullException(nameof(request));
            }

            if (request.Review.Id == null)
            {
                request.Review.Id = Guid.NewGuid().ToString();
            }

            if (!string.IsNullOrEmpty(request.Domain))
            {
                logger.LogInformation("Using Domain dictionary [{0}]", request.Domain);
                client.Lexicon = lexiconLoader.GetLexicon(request.Domain);
            }

            var id = GetId(request);

            var result = await cache
                         .GetOrCreateAsync(id,
                                           async entry =>
            {
                entry.SlidingExpiration = TimeSpan.FromMinutes(10);

                return(await client.Process(
                           documentConverter.Convert(request.Review, request.CleanText))
                       .ConfigureAwait(false));
            })
                         .ConfigureAwait(false);

            return(result);
        }
Ejemplo n.º 2
0
 private static void ConvertOne(IDocumentConverter converter, FileInfo inputFile, FileInfo outputFile, bool verbose)
 {
     if (verbose)
     {
         Console.Out.WriteLine("-- converting " + inputFile + " to " + outputFile);
     }
     converter.Convert(inputFile, outputFile);
 }
Ejemplo n.º 3
0
 public override string Convert(IDocumentConverter converter)
 {
     return(converter.Convert(this));
 }
Ejemplo n.º 4
0
 public void Convert(IDocumentConverter converter)
 {
     converter.Convert(this);
 }