1
0
Fork 0
mirror of https://gitlab.com/niansa/anyproc.git synced 2025-03-06 20:49:24 +01:00
anyproc/dictionary.cpp
2023-04-16 21:08:29 +02:00

33 lines
821 B
C++

#include "anyproc.hpp"
#include <iostream>
#include <string>
#include <justlm.hpp>
int main() {
const auto progress_indicator = [](float progress) {
std::cout << unsigned(progress) << "% \r" << std::flush;
return true;
};
const auto result_printer = [](const char *token) {
std::cout << token << std::flush;
return true;
};
Dictionary dict("13B-ggml-model-quant.bin");
for (;;) {
std::string what;
std::cout << "What: " << std::flush;
std::getline(std::cin, what);
for (;;) {
std::string word;
std::cout << "\rWord: " << std::flush;
std::getline(std::cin, word);
if (word.empty()) break;
dict.lookup(word, what, progress_indicator, result_printer);
}
}
}