Upload 2 files
Browse files- ChatIPC.cpp +6 -4
- ChatIPC.exe +1 -1
ChatIPC.cpp
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
|
|
|
|
|
| 1 |
#include <algorithm>
|
| 2 |
#include <atomic>
|
| 3 |
#include <cctype>
|
|
@@ -339,9 +341,9 @@ static std::string best_candidate_by_similarity(const NextSet &cands,
|
|
| 339 |
return best_tok;
|
| 340 |
}
|
| 341 |
|
| 342 |
-
// --------------------------- Response
|
| 343 |
|
| 344 |
-
static std::vector<std::string>
|
| 345 |
const std::vector<std::string> &prompt_toks,
|
| 346 |
size_t maxlen,
|
| 347 |
const std::unordered_map<std::string,std::unordered_set<std::string>> &def_index,
|
|
@@ -577,7 +579,7 @@ static void load_kb_binary(KnowledgeBase &kb, const std::string &fname, int cli_
|
|
| 577 |
|
| 578 |
static void print_usage(const char *p){
|
| 579 |
std::cout << "Usage: " << p << " [--maxlen N] [--save FILE] [--load-kb FILE] [--dict-depth D] [--learn f1 f2 ...] [--repeat-penalty P] [--help]\n";
|
| 580 |
-
std::cout << " --maxlen N Maximum number of tokens
|
| 581 |
std::cout << " --save FILE Save the knowledge-base and dictionary expansions to a binary file.\n";
|
| 582 |
std::cout << " --load-kb FILE Load a previously saved knowledge-base (and dictionary expansions) from a binary file.\n";
|
| 583 |
std::cout << " --dict-depth D Depth of dictionary-definition expansion used during learning.\n";
|
|
@@ -641,7 +643,7 @@ int main(int argc, char **argv){
|
|
| 641 |
auto prompt_toks = tokenize_whitespace(line);
|
| 642 |
for (size_t i=1;i<prompt_toks.size();++i) kb.add_pair(prompt_toks[i-1], prompt_toks[i]);
|
| 643 |
auto def_index = snapshot_def_index(kb);
|
| 644 |
-
auto resp =
|
| 645 |
std::cout << "\n";
|
| 646 |
if (!resp.empty()){
|
| 647 |
std::vector<std::string> combined = prompt_toks;
|
|
|
|
| 1 |
+
// ChatIPC := Chat Incremental Pattern Constructor
|
| 2 |
+
|
| 3 |
#include <algorithm>
|
| 4 |
#include <atomic>
|
| 5 |
#include <cctype>
|
|
|
|
| 341 |
return best_tok;
|
| 342 |
}
|
| 343 |
|
| 344 |
+
// --------------------------- Response constructor (short units) ---------------
|
| 345 |
|
| 346 |
+
static std::vector<std::string> construct_response(KnowledgeBase &kb,
|
| 347 |
const std::vector<std::string> &prompt_toks,
|
| 348 |
size_t maxlen,
|
| 349 |
const std::unordered_map<std::string,std::unordered_set<std::string>> &def_index,
|
|
|
|
| 579 |
|
| 580 |
static void print_usage(const char *p){
|
| 581 |
std::cout << "Usage: " << p << " [--maxlen N] [--save FILE] [--load-kb FILE] [--dict-depth D] [--learn f1 f2 ...] [--repeat-penalty P] [--help]\n";
|
| 582 |
+
std::cout << " --maxlen N Maximum number of tokens constructed in a response.\n";
|
| 583 |
std::cout << " --save FILE Save the knowledge-base and dictionary expansions to a binary file.\n";
|
| 584 |
std::cout << " --load-kb FILE Load a previously saved knowledge-base (and dictionary expansions) from a binary file.\n";
|
| 585 |
std::cout << " --dict-depth D Depth of dictionary-definition expansion used during learning.\n";
|
|
|
|
| 643 |
auto prompt_toks = tokenize_whitespace(line);
|
| 644 |
for (size_t i=1;i<prompt_toks.size();++i) kb.add_pair(prompt_toks[i-1], prompt_toks[i]);
|
| 645 |
auto def_index = snapshot_def_index(kb);
|
| 646 |
+
auto resp = construct_response(kb, prompt_toks, maxlen, def_index, repeat_penalty);
|
| 647 |
std::cout << "\n";
|
| 648 |
if (!resp.empty()){
|
| 649 |
std::vector<std::string> combined = prompt_toks;
|
ChatIPC.exe
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
size 24027648
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:78a4fac31f917226ad493237836ed29d72f5a99987a24407be977705757bcdb3
|
| 3 |
size 24027648
|