public static List <string> JiebaWords2StringList(ref JiebaWords words) { var ret = new List <string>(); for (int i = 0; i < words.Count; ++i) { var wordPtrEntryInArray = IntPtr.Add(words.Words, IntPtr.Size * i); var wordPtr = Marshal.PtrToStructure <IntPtr>(wordPtrEntryInArray); var word = Marshal.PtrToStringUTF8(wordPtr); ret.Add(word); } return(ret); }
public static extern uint jieba_cut_all_full(IntPtr ctx, [MarshalAs(UnmanagedType.LPUTF8Str)] string sentence, uint len, ref JiebaWords words);
public static extern uint jieba_cut_for_search_full(IntPtr ctx, [MarshalAs(UnmanagedType.LPUTF8Str)] string sentence, uint len, ref JiebaWords words, bool hmm = true);
public static extern void jieba_words_free(ref JiebaWords w);