コード例 #1
0
        public DetectedLanguageResponse DetectLanguage(LanguageDetectRequest model)
        {
            IEnumerable <Tuple <LanguageInfo, double> > matches = _identifier.Identify(model.TextForLanguageClassification);
            DetectedLanguageResponse detectedLanguageResponse   = FormatResponse(matches, model);

            return(detectedLanguageResponse);
        }
コード例 #2
0
        public DetectedLanguageResponse DetectLanguage(LanguageDetectRequest model)
        {
            IEnumerable<Tuple<LanguageInfo, double>> matches = _identifier.Identify(model.TextForLanguageClassification);
            DetectedLanguageResponse detectedLanguageResponse = FormatResponse(matches, model);

            return detectedLanguageResponse;
        }
コード例 #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);
 }
コード例 #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));
        }
コード例 #5
0
 private static bool ModelIsInvalid(LanguageDetectRequest model)
 {
     return model == null || string.IsNullOrWhiteSpace(model.TextForLanguageClassification);
 }