Last active
April 16, 2018 08:38
FastText C-style bindings for .NET
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class FastTextWrapper | |
{ | |
[return: MarshalAs(UnmanagedType.Bool)] | |
[UnmanagedFunctionPointer(callingConvention: CallingConvention.Cdecl, CharSet = CharSet.Ansi)] | |
public delegate bool FastTextNNCallback(StringBuilder word, Single score, IntPtr data); | |
[DllImport(dllName: "fasttext.dll", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi, SetLastError = true)] | |
[return: MarshalAs(UnmanagedType.Bool)] | |
public static extern bool fasttext_new(out IntPtr ft); | |
[DllImport(dllName: "fasttext.dll", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi, SetLastError = true)] | |
[return: MarshalAs(UnmanagedType.Bool)] | |
public static extern bool fasttext_release(IntPtr ft); | |
[DllImport(dllName: "fasttext.dll", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi, SetLastError = true)] | |
[return: MarshalAs(UnmanagedType.Bool)] | |
public static extern bool fasttext_nn2(IntPtr ft, IntPtr mx, string[] positive, string[] negative, int count, FastTextNNCallback callback, IntPtr data); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment