#include <iostream>#include "fasttext/fasttext.h"#include "../src/log.h"int main() {std::cout << "Hello, World!" << std::endl;std::shared_ptr<fasttext::FastText> model = std::make_shared<fasttext::FastText>();std::string model_path = "../pack/models/td_dim32_b2.ftz";model->loadModel(model_path.c_str());// 假设这是经过分词的文本std::string text_seg = "sss";fasttext::Predictions predictions;std::vector<int32_t> wds = {model->getWordId(text_seg)};model->predict(1, wds, predictions);// LOGD("word: %d", model->getWordId("调节"));std::cout << "预测: " << predictions[0].second << " 置信度: " << std::exp(predictions[0].first) << std::endl;return 0;}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。