Created
Apr ’24
Replies
7
Boosts
0
Views
1.1k
Participants
2
coremltools doesn't appear to support this. Looks like the answer is no.
Hello, I wanted to do the same, did you have a go at compiling CRFSuite in Xcode?
Yes I did compile CRFSuite in Xcode. After compiling it myself I noticed after that Apple actually includes libCRFSuite in the SDK. If you open your Xcode project and choose link framework you can search for CRFSuite and you can link libcrfsuite.tbd in your project.
I haven't tried linking against Apple's version myself though (still linking against my own from source). Quickly taking a look though I don't see the header file for libcrfsuite. I imagine crfsuite.h would be in usr/include somewhere. Not sure what's up with that.
I was hoping to convert a model to CoreML and use it with NLTagger because I imagine it would use a lot less memory though the CRFSuite model I'm using isn't too big so I'm going to use it as is for now rather than trying to retrain the entire thing with CoreML because I got a million other things to do.
As a sidetone, I haven't really been able to do much with CoreML. All the models I'm interested in using in my app don't work with it. Overall I've had a much easier time using ONNX. But for this model I'm sticking with CRFSuite for now.
Thanks a lot for the information! I didn't quite finish wrapping the C code so I will take a look at libcrfsuite, well done I would not have thought to look for that. I was looking to tokenize thai syllables and in Apple's frameworks word is the smallest unit so there's no way, not even with a Gazetteer 😅
[@Macho Man ***** Savage](https://developer.apple.com/forums/profile/Macho Man ***** Savage) I didn't manage to get it running so far, I suspect that libcrfsuite is for private Apple only use. So back to getting it to compile, I need to run it on iOS on the device, did you managed to get that far? I tried to call/wrap via Swift but I suspect it's better to start with Objective-C.
I didn't manage to get it running so far, I suspect that libcrfsuite is for private Apple only use
If it's for private API use only it shouldn't appear in the list under Apple SDKs. Maybe someone from Apple could clarify? If you want to try a lazy approach, you could just grab the header files from Github and link against the Apple provided version. I think you are better off building CRFSuite yourself though (to protect your app from crashing if Apple decides to remove it from the SDK in the future).
You might be able to get crfsuite to compile from the command line with make but I didn't do it that way. I made an Xcode framework project (you could also do a static library project as well if static linking works better for you) and added all the source code. There are a lot of warnings but they aren't too difficult to resolve. I think I had to make a couple of other changes to get the crfsuite models to work on Apple Silicon. Then I wrote a couple of Objective-C classes that wraps the functionality I need.
Thanks a lot for your help much appreciated. I managed to compile it as a framework. For the device a few symbols (used to init/load models) in libcrfsuite are not a one to one match with the CRFSuite header, so it's a little bit too much of a black box / rabbit hole for me to spend more time on at the moment.