public Task <LanguageDetectionDto> CallLanguageDetectionAsync(LanguageDetectionParameters parameters)
        {
            ServiceUtils.ParameterValidation(parameters);
            var source = SourceValidationService.verifySingleSource(parameters);

            return(_apiClient.CallApiAsync <LanguageDetectionDto>(ApiClient.LanguageDetectionUriBuilder(), ApiClient.LanguageDetectionContentBuilder(source, parameters), parameters.HttpMethod));
        }
Пример #2
0
        /// <summary>
        ///     Allocates a dictionary that contains the parameters for the call
        /// </summary>
        /// <param name="source"> a dictionary that contains the text source</param>
        /// <param name="parameters"></param>
        /// <returns>Returns the dictionary </returns>
        public static List <KeyValuePair <string, string> > LanguageDetectionContentBuilder(List <KeyValuePair <string, string> > source, LanguageDetectionParameters parameters)
        {
            var content = new List <KeyValuePair <string, string> >();

            content.Add(new KeyValuePair <string, string>("token", parameters.Token));
            content.AddRange(source);

            if (parameters.Clean != DefaultValues.Clean)
            {
                content.Add(new KeyValuePair <string, string>("clean", parameters.Clean.ToString()));
            }

            return(content);
        }
Пример #3
0
 /// <summary>
 ///     Asyncronous method that call <see href="https://dandelion.eu/docs/api/datatxt/li/v1/">Language Detection end-point</see> on a text source
 /// </summary>
 /// <param name="parameters"> Parameters to specify all options for the Language Detection process </param>
 /// <returns>Returns a <c>LanguageDetectionDto</c> populated with the result of the Language Detection process </returns>
 /// <seealso cref="LanguageDetectionDto"/>
 public static Task <LanguageDetectionDto> DetectLanguageAsync(LanguageDetectionParameters parameters)
 {
     Init();
     return(_languageDetectionService.CallLanguageDetectionAsync(parameters));
 }