コード例 #1
0
        public double GetTranslationProbability(string sourceWord, string targetWord)
        {
            CheckDisposed();

            IntPtr nativeSourceWord = Thot.ConvertStringToNativeUtf8(sourceWord ?? "NULL");
            IntPtr nativeTargetWord = Thot.ConvertStringToNativeUtf8(targetWord ?? "NULL");

            try
            {
                return(Thot.swAlignModel_getTranslationProbability(Handle, nativeSourceWord, nativeTargetWord));
            }
            finally
            {
                Marshal.FreeHGlobal(nativeTargetWord);
                Marshal.FreeHGlobal(nativeSourceWord);
            }
        }