fasttext_flutter 0.1.1
fasttext_flutter: ^0.1.1 copied to clipboard
On-device text classification and sentence embeddings using fastText .ftz quantized models via Dart FFI. Verified on Android. Contributions welcome
0.1.1 #
- Fix (Android): Added missing
aligned.hheader from fastText's bundled intgemm library — resolvesfatal error: 'aligned.h' file not foundwhen compiling with Android NDK clang. - Fix (Android): Added
-D_POSIX_C_SOURCE=200809Lbuild flag to guaranteeposix_memalignavailability on all Android API levels ≥ 24.
0.1.0 #
- Initial release.
- Load
.ftz(quantized) and.bin(full) fastText models from the file system or Flutter assets. predict(text, {k, threshold})— top-k text classification for supervised models, returnsList<FastTextPrediction>.computeEmbedding(text)— dense sentence-vector embeddings asFloat32List, works for all model types.FastTextModel.cosineSimilarity(a, b)— static cosine-similarity helper.FastTextModelTypeenum — detect whether the model issupervised,cbow, orskipgramat runtime.- All inference runs in a background
Isolate— the Flutter UI thread is never blocked. NativeFinalizer-based automatic memory management with explicitclose()for deterministic cleanup.- Platform support: Android (arm64, arm, x86_64), iOS, macOS, Linux, Windows.
- fastText C++ library compiled from source via
native_toolchain_cbuild hooks — no pre-built binaries.