CoreLM // Implementing step-based debug prints.

This commit is contained in:
ShikiSuen 2022-02-26 02:57:03 +08:00
parent 66933ca934
commit 2369dc67e1
1 changed files with 12 additions and 1 deletions

View File

@ -123,6 +123,7 @@ start:
c = *head; c = *head;
// \s -> error // \s -> error
if (c == ' ') { if (c == ' ') {
syslog(LOG_CONS, "vChewingDebug: CoreLM // Start: \\s -> error");
goto error; goto error;
} }
// \n -> start // \n -> start
@ -139,12 +140,14 @@ start:
state1: state1:
// EOF -> error // EOF -> error
if (head == end) { if (head == end) {
syslog(LOG_CONS, "vChewingDebug: CoreLM // state 1: EOF -> error");
goto error; goto error;
} }
c = *head; c = *head;
// \n -> error // \n -> error
if (c == '\n') { if (c == '\n') {
syslog(LOG_CONS, "vChewingDebug: CoreLM // state 1: \\n -> error");
goto error; goto error;
} }
// \s -> state2 + zero out ending + record column start // \s -> state2 + zero out ending + record column start
@ -162,12 +165,14 @@ state1:
state2: state2:
// eof -> error // eof -> error
if (head == end) { if (head == end) {
syslog(LOG_CONS, "vChewingDebug: CoreLM // state 2: EOF -> error");
goto error; goto error;
} }
c = *head; c = *head;
// \n, \s -> error // \n, \s -> error
if (c == '\n' || c == ' ') { if (c == '\n' || c == ' ') {
syslog(LOG_CONS, "vChewingDebug: CoreLM // state 2: \\n \\s -> error");
goto error; goto error;
} }
@ -179,6 +184,7 @@ state2:
state3: state3:
// eof -> error // eof -> error
if (head == end) { if (head == end) {
syslog(LOG_CONS, "vChewingDebug: CoreLM // state 3: EOF -> error");
goto error; goto error;
} }
@ -186,6 +192,7 @@ state3:
// \n -> error // \n -> error
if (c == '\n') { if (c == '\n') {
syslog(LOG_CONS, "vChewingDebug: CoreLM // state 3: \\n -> error");
goto error; goto error;
} }
// \s -> state4 + zero out ending + record column start // \s -> state4 + zero out ending + record column start
@ -203,12 +210,14 @@ state3:
state4: state4:
// eof -> error // eof -> error
if (head == end) { if (head == end) {
syslog(LOG_CONS, "vChewingDebug: CoreLM // state 4: EOF -> error");
goto error; goto error;
} }
c = *head; c = *head;
// \n, \s -> error // \n, \s -> error
if (c == '\n' || c == ' ') { if (c == '\n' || c == ' ') {
syslog(LOG_CONS, "vChewingDebug: CoreLM // state 4: \\n \\s -> error");
goto error; goto error;
} }
@ -221,12 +230,14 @@ state4:
state5: state5:
// eof -> error // eof -> error
if (head == end) { if (head == end) {
syslog(LOG_CONS, "vChewingDebug: CoreLM // state 5: EOF -> error");
goto error; goto error;
} }
c = *head; c = *head;
// \s -> error // \s -> error
if (c == ' ') { if (c == ' ') {
syslog(LOG_CONS, "vChewingDebug: CoreLM // state 5: \\s -> error");
goto error; goto error;
} }
// \n -> start // \n -> start
@ -253,7 +264,7 @@ end:
emptyRow.value = space; emptyRow.value = space;
emptyRow.logProbability = zero; emptyRow.logProbability = zero;
keyRowMap[space].push_back(emptyRow); keyRowMap[space].push_back(emptyRow);
syslog(LOG_CONS, "vChewingDebug: CoreLM // File Load Complete.");
return true; return true;
} }