public static NLLanguage GetDominantLanguage(string @string)
        {
            var nsstring = NSString.CreateNative(@string);
            var nslang   = _GetDominantLanguage(nsstring);
            var lang     = NLLanguageExtensions.GetValue(nslang);

            nslang?.Dispose();
            NSString.ReleaseNative(nsstring);
            return(lang);
        }
示例#2
0
        static internal Dictionary <NLLanguage, double> Convert(NSDictionary <NSString, NSNumber> dict)
        {
            var result = new Dictionary <NLLanguage, double> ((int)dict.Count);

            foreach (var k in dict.Keys)
            {
                result [NLLanguageExtensions.GetValue(k)] = dict [k].DoubleValue;
            }
            return(result);
        }
示例#3
0
        public Dictionary <NLLanguage, double>[] GetPredictedLabelHypotheses(string[] tokens, nuint maximumCount)
        {
            var hypos  = GetNativePredictedLabelHypotheses(tokens, maximumCount);
            var result = new Dictionary <NLLanguage, double> [hypos.Length];

            for (int i = 0; i < result.Length; i++)
            {
                result [i] = NLLanguageExtensions.Convert(hypos [i]);
            }
            return(result);
        }
 public Dictionary <NLLanguage, double> GetLanguageHypotheses(nuint maxHypotheses)
 {
     using (var hypo = GetNativeLanguageHypotheses(maxHypotheses)) {
         var result = new Dictionary <NLLanguage, double> (hypo.Keys.Length);
         foreach (var k in hypo.Keys)
         {
             result[NLLanguageExtensions.GetValue(k)] = hypo[k].DoubleValue;
         }
         return(result);
     }
 }
示例#5
0
        public static NLLanguage GetDominantLanguage(string @string)
        {
            var nsstring = NSString.CreateNative(@string);

            try {
                using (var nslang = _GetDominantLanguage(nsstring))
                    return(NLLanguageExtensions.GetValue(nslang));
            }
            finally {
                NSString.ReleaseNative(nsstring);
            }
        }
        public static NLLanguage GetDominantLanguage(string @string)
        {
            var nsstring = NSString.CreateNative(@string);
            var nslang   = _GetDominantLanguage(nsstring);
            var lang     = NLLanguage.Undetermined;

            if (nslang != null)
            {
                lang = NLLanguageExtensions.GetValue(nslang);
            }
            NSString.ReleaseNative(nsstring);
            nslang.Dispose();
            return(lang);
        }
示例#7
0
 public Dictionary <NLLanguage, double> GetPredictedLabelHypotheses(string @string, nuint maximumCount)
 {
     using (var hypo = GetNativePredictedLabelHypotheses(@string, maximumCount))
         return(NLLanguageExtensions.Convert(hypo));
 }
示例#8
0
 public Dictionary <NLLanguage, double> GetTagHypotheses(nuint characterIndex, NLTokenUnit unit, NLTagScheme scheme, nuint maximumCount)
 {
     using (var hypo = GetNativeTagHypotheses(characterIndex, unit, scheme.GetConstant(), maximumCount))
         return(NLLanguageExtensions.Convert(hypo));
 }
示例#9
0
 public Dictionary <NLLanguage, double> GetLanguageHypotheses(nuint maxHypotheses)
 {
     using (var hypo = GetNativeLanguageHypotheses(maxHypotheses)) {
         return(NLLanguageExtensions.Convert(hypo));
     }
 }