Пример #1
0
        internal static AnalyzeTextJobStatusResult ConvertToAnalyzeTextJobStatusResult(AnalyzeTextJobState jobState, IDictionary <string, int> map)
        {
            var result = new AnalyzeTextJobStatusResult
            {
                DisplayName      = jobState.DisplayName,
                NextLink         = jobState.NextLink,
                CreatedOn        = jobState.CreatedDateTime,
                LastModifiedOn   = jobState.LastUpdateDateTime,
                ExpiresOn        = jobState.ExpirationDateTime,
                AcionsSucceeded  = jobState.Tasks.Completed,
                AcionsInProgress = jobState.Tasks.InProgress,
                ActionsFailed    = jobState.Tasks.Failed,
                ActionsTotal     = jobState.Tasks.Total,
                Status           = jobState.Status
            };

            if (result.Status == TextAnalyticsOperationStatus.Succeeded)
            {
                result.Result = ConvertToAnalyzeActionsResult(jobState, map);
            }

            foreach (var error in jobState.Errors)
            {
                result.Errors.Add(error);
            }

            return(result);
        }
Пример #2
0
 private static bool CheckIfGenericError(AnalyzeTextJobStatusResult jobState)
 {
     foreach (Error error in jobState.Errors)
     {
         if (string.IsNullOrEmpty(error.Target))
         {
             return(true);
         }
     }
     return(false);
 }