I want to use the FastText.NetWrapper library in my project. I imported the library and wrote the sample code, but after running it, I get the following error:
Unhandled exception. System.DllNotFoundException: Unable to load shared library 'fasttext' or one of its dependencies. In order to help diagnose loading problems, consider setting the DYLD_PRINT_LIBRARIES environment variable:
dlopen(/Users/a/Desktop/Spell Corrector/MyMLNetProject/bin/Debug/net7.0/runtimes/osx-arm64/native/fasttext.dylib, 0x0001):
tried:
'/Users/a/Desktop/Spell Corrector/MyMLNetProject/bin/Debug/net7.0/runtimes/osx-arm64/native/fasttext.dylib' (no such file),
'/System/Volumes/Preboot/Cryptexes/OS/Users/a/Desktop/Spell Corrector/MyMLNetProject/bin/Debug/net7.0/runtimes/osx-arm64/native/fasttext.dylib' (no such file),
'/Users/a/Desktop/Spell Corrector/MyMLNetProject/bin/Debug/net7.0/runtimes/osx-arm64/native/fasttext.dylib' (no such file)
I'm sure I installed the library correctly.I'm posting a code for an example.
using FastText.NetWrapper;
using System;
class Program
{
static void Main(string[] args)
{
using (var classifier = new FastTextWrapper())
{
classifier.Supervised("train.txt", "model");
string testText = "Bu bir test metnidir.";
var result = classifier.PredictSingle(testText);
Console.WriteLine($"Tahmin edilen sınıf: {result.Label}");
Console.WriteLine($"Tahmin edilen olasılık: {result.Probability}");
}
}
}
Can someone help about this?
I tried to train a model , it didn't work.
When you try to use dotnet on Mac, there may be problems with the path of the libraries. If you change the path of the file to
, the problem will be solved, but for this you need to turn off SIP security. This solved my problem.