Last active
April 16, 2018 08:38
-
-
Save tondrej/91a9b9d336c411943a9483543e7ce49f to your computer and use it in GitHub Desktop.
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