//#region Lemmatization ///// <summary> ///// Lemmatize sentence. By default expects tokens to be separated by '|'. ///// </summary> ///// <param name="sentence">Sentence to lemmatize.</param> ///// <param name="separator">Token separator.</param> ///// <returns>Lemmatized tokens.</returns> //public string[] LemmatizeSentence(string sentence, char separator = '|') //{ // if (string.IsNullOrEmpty(sentence)) // { // return new string[0]; // } // var lemResult = GrammarApi.sol_LemmatizePhraseW(_lemmatizer, sentence, 0, separator); // if (lemResult == IntPtr.Zero) // { // return new string[0]; // } // int lemmaCnt = GrammarApi.sol_CountLemmas(lemResult); // var result = new string[lemmaCnt]; // var buffer = new StringBuilder(120); // for (int i = 0; i < lemmaCnt; i++) // { // GrammarApi.sol_GetLemmaStringW(lemResult, i, buffer, 120); // result[i] = buffer.ToString(); // buffer.Clear(); // } // GrammarApi.sol_DeleteLemmas(lemResult); // return result; //} //#endregion #region Misc public string NormalizePhrase(AnalysisResults linkages) { var wchar_ptr = GrammarApi.sol_NormalizePhraseW(_engine, linkages.GetHandle()); if (wchar_ptr == (IntPtr)null) { return(""); } var res = Marshal.PtrToStringUni(wchar_ptr); GrammarApi.sol_Free(_engine, wchar_ptr); return(res); }