Reset // Let User LMs print error logs when data format corrupts.
This commit is contained in:
parent
b0f47828ec
commit
d82c97b8d9
|
@ -83,6 +83,12 @@ bool AssociatedPhrases::open(const char *path)
|
|||
while ((state = reader.Next(&keyValue)) == KeyValueBlobReader::State::HAS_PAIR) {
|
||||
keyRowMap[keyValue.key].emplace_back(keyValue.key, keyValue.value);
|
||||
}
|
||||
// 下面這一段或許可以做成開關、來詢問是否對使用者語彙採取寬鬆策略(哪怕有行內容寫錯也會放行)
|
||||
if (state == KeyValueBlobReader::State::ERROR) {
|
||||
// close();
|
||||
syslog(LOG_CONS, "AssociatedPhrases: Failed at Open Step 5. On Error Resume Next.\n");
|
||||
// return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR TH
|
|||
#include <fcntl.h>
|
||||
#include <fstream>
|
||||
#include <unistd.h>
|
||||
#include <syslog.h>
|
||||
|
||||
#include "KeyValueBlobReader.h"
|
||||
|
||||
|
@ -77,6 +78,12 @@ bool PhraseReplacementMap::open(const char *path)
|
|||
while ((state = reader.Next(&keyValue)) == KeyValueBlobReader::State::HAS_PAIR) {
|
||||
keyValueMap[keyValue.key] = keyValue.value;
|
||||
}
|
||||
// 下面這一段或許可以做成開關、來詢問是否對使用者語彙採取寬鬆策略(哪怕有行內容寫錯也會放行)
|
||||
if (state == KeyValueBlobReader::State::ERROR) {
|
||||
// close();
|
||||
syslog(LOG_CONS, "PhraseReplacementMap: Failed at Open Step 5. On Error Resume Next.\n");
|
||||
// return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR TH
|
|||
#include <fcntl.h>
|
||||
#include <fstream>
|
||||
#include <unistd.h>
|
||||
#include <syslog.h>
|
||||
|
||||
#include "KeyValueBlobReader.h"
|
||||
|
||||
|
@ -84,6 +85,12 @@ bool UserPhrasesLM::open(const char *path)
|
|||
// We invert the key and value, since in user phrases, "key" is the phrase value, and "value" is the BPMF reading.
|
||||
keyRowMap[keyValue.value].emplace_back(keyValue.value, keyValue.key);
|
||||
}
|
||||
// 下面這一段或許可以做成開關、來詢問是否對使用者語彙採取寬鬆策略(哪怕有行內容寫錯也會放行)
|
||||
if (state == KeyValueBlobReader::State::ERROR) {
|
||||
// close();
|
||||
syslog(LOG_CONS, "UserPhrasesLM: Failed at Open Step 5. On Error Resume Next.\n");
|
||||
// return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue