Ejemplo n.º 1
0
 public DetectTextHandler(TextractTextDetectionService textractTextService)
 {
     this.textractTextService = textractTextService;
 }
        static void Main(string[] args)
        {
            if (args.Length == 0)
            {
                Console.WriteLine(HelpText);
                return;
            }

            var firstArg = args[0];

            var builder = new ConfigurationBuilder()
                          .SetBasePath(Environment.CurrentDirectory)
                          .AddJsonFile("appsettings.json", optional: false, reloadOnChange: true)
                          .AddEnvironmentVariables()
                          .Build();
            var awsOptions = builder.GetAWSOptions();

            Console.WriteLine(awsOptions.Profile + ":" + awsOptions.ProfilesLocation + ": " + awsOptions.Region.DisplayName);
            var textractTextService      = new TextractTextDetectionService(awsOptions.CreateServiceClient <IAmazonTextract>());
            var textractAnalysisService  = new TextractTextAnalysisService(awsOptions.CreateServiceClient <IAmazonTextract>());
            var translateService         = new TranslateService(awsOptions.CreateServiceClient <IAmazonTranslate>());
            var comprehendService        = new ComprehendService(awsOptions.CreateServiceClient <IAmazonComprehend>());
            var comprehendMedicalService = new ComprehendService(awsOptions.CreateServiceClient <IAmazonComprehendMedical>());
            var elasticSearchService     = new ElasticSearchService(ElasticSearchEndpoint, ElasticSearchDomainName);

            switch (firstArg)
            {
            case "--detect-text-local":
                new DetectTextHandler(textractTextService).Handle(LocalEmploymentFile);
                break;

            case "--detect-text-s3":
                new DetectTextS3Handler(textractTextService).Handle(BucketName, S3File);
                break;

            case "--pdf-text":
                new PdfTextHandler(textractTextService).Handle(BucketName, PdfFile);
                break;

            case "--reading-order":
                new ReadingOrderHandler(textractTextService).Handle(BucketName, TwoColumnImage);
                break;

            case "--translate":
                new TranslateHandler(textractTextService, translateService).Handle(BucketName, S3File);
                break;

            case "--search":
                new SearchHandler(textractTextService, elasticSearchService).Handle(BucketName, S3File);
                break;

            case "--forms":
                new FormsHandler(textractAnalysisService).Handle(BucketName, FormFile);
                break;

            case "--forms-redaction":
                new FormsRedactionHandler(textractAnalysisService).Handle(BucketName, FormFile, LocalFolder, LocalEmploymentFile);
                break;

            case "--tables":
                new TablesHandler(textractAnalysisService).Handle(BucketName, FormFile);
                break;

            case "--tables-expense":
                new TablesExpenseHandler(textractAnalysisService).Handle(BucketName, ExpenseFile);
                break;

            case "--nlp-comprehend":
                new NlpComprehendHandler(textractTextService, comprehendService).Handle(LocalSimpleFile);
                break;

            case "--nlp-medical":
                new NlpComprehendMedicalHandler(textractTextService, comprehendMedicalService).Handle(LocalMedicalFile);
                break;

            default:
                Console.WriteLine(HelpText);
                break;
            }
        }
Ejemplo n.º 3
0
 public NlpComprehendHandler(TextractTextDetectionService textractTextService, ComprehendService comprehendService)
 {
     this.textractTextService = textractTextService;
     this.comprehendService   = comprehendService;
 }
 public ReadingOrderHandler(TextractTextDetectionService textractTextService)
 {
     this.textractTextService = textractTextService;
 }
 public TranslateHandler(TextractTextDetectionService textractTextService, TranslateService translateService)
 {
     this.textractTextService = textractTextService;
     this.translateService    = translateService;
 }
Ejemplo n.º 6
0
 public SearchHandler(TextractTextDetectionService textractTextService, ElasticSearchService elasticSearchService)
 {
     this.textractTextService  = textractTextService;
     this.elasticSearchService = elasticSearchService;
 }