public DetectedLanguageResponse DetectLanguage(LanguageDetectRequest model) { IEnumerable <Tuple <LanguageInfo, double> > matches = _identifier.Identify(model.TextForLanguageClassification); DetectedLanguageResponse detectedLanguageResponse = FormatResponse(matches, model); return(detectedLanguageResponse); }
public DetectedLanguageResponse DetectLanguage(LanguageDetectRequest model) { IEnumerable<Tuple<LanguageInfo, double>> matches = _identifier.Identify(model.TextForLanguageClassification); DetectedLanguageResponse detectedLanguageResponse = FormatResponse(matches, model); return detectedLanguageResponse; }
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); }
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)); }
private static bool ModelIsInvalid(LanguageDetectRequest model) { return model == null || string.IsNullOrWhiteSpace(model.TextForLanguageClassification); }