1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
|
/*
* SPDX-FileCopyrightText: 2017-2017 CSSlayer <wengxt@gmail.com>
*
* SPDX-License-Identifier: LGPL-2.1-or-later
*/
#include <string>
#include <vector>
#include <fcitx-utils/log.h>
#include "libime/core/historybigram.h"
#include "libime/core/prediction.h"
#include "libime/core/userlanguagemodel.h"
#include "testdir.h"
using namespace libime;
int main() {
UserLanguageModel model(LIBIME_BINARY_DIR "/data/sc.lm");
Prediction pred;
pred.setUserLanguageModel(&model);
model.history().add({"你", "希望"});
for (const auto &result : pred.predict(std::vector<std::string>{"你"})) {
FCITX_LOG(Info) << result;
}
for (const auto &result : pred.predict(std::vector<std::string>{"你"})) {
FCITX_LOG(Info) << result;
}
return 0;
}
|