Ejemplo n.º 1
0
        public DetectedLanguageResponse DetectLanguage(LanguageDetectRequest model)
        {
            IEnumerable <Tuple <LanguageInfo, double> > matches = _identifier.Identify(model.TextForLanguageClassification);
            DetectedLanguageResponse detectedLanguageResponse   = FormatResponse(matches, model);

            return(detectedLanguageResponse);
        }
Ejemplo n.º 2
0
        public DetectedLanguageResponse DetectLanguage(LanguageDetectRequest model)
        {
            IEnumerable<Tuple<LanguageInfo, double>> matches = _identifier.Identify(model.TextForLanguageClassification);
            DetectedLanguageResponse detectedLanguageResponse = FormatResponse(matches, model);

            return detectedLanguageResponse;
        }
Ejemplo n.º 3
0
 private DetectedLanguageResponse FormatResponse(IEnumerable<Tuple<LanguageInfo, double>> matches, LanguageDetectRequest model)
 {
     List<DetectedLangage> responseList = matches.Select(
         match => _builder.BuildFromResult(match.Item1, match.Item2))
         .ToList();
     return new DetectedLanguageResponse(responseList, model.TextForLanguageClassification);
 }
Ejemplo n.º 4
0
        private DetectedLanguageResponse FormatResponse(IEnumerable <Tuple <LanguageInfo, double> > matches, LanguageDetectRequest model)
        {
            List <DetectedLangage> responseList = matches.Select(
                match => _builder.BuildFromResult(match.Item1, match.Item2))
                                                  .ToList();

            return(new DetectedLanguageResponse(responseList, model.TextForLanguageClassification));
        }
Ejemplo n.º 5
0
 private static bool ModelIsInvalid(LanguageDetectRequest model)
 {
     return model == null || string.IsNullOrWhiteSpace(model.TextForLanguageClassification);
 }