Warning: session_start(): open(/var/lib/php/sessions/sess_so62d5o7a96158g90ugpdkt15m, O_RDWR) failed: No space left on device (28) in /var/www/tb-usercake/models/config.php on line 51
Warning: session_start(): Failed to read session data: files (path: /var/lib/php/sessions) in /var/www/tb-usercake/models/config.php on line 51
!7
srecord Replacement(S in, S out) {
// in = heard phrase, out = said phrase
}
cmodule ELEApplyRecognitionReplacements > DynPrintLogAndEnabled {
start {
dm_onUserUtteranceWithoutMine(ivf1 processInput);
}
void processInput(S input) {
L
l = getReplacements();
SS map = ciMapFromKeyAndValueField('in, 'out, l);
FullPhraseCache phraseCache = makeFullPhraseCache(map(l, r -> r.in));
LS tok = javaTokNPunct(input);
L ranges = fullPhraseCache_tokenRanges(phraseCache, tok);
if (empty(ranges)) ret;
print("Found replaceable phrases: " + getJoinedTokenRangesWithoutN(tok, ranges));
tok = cloneList(tok);
for (IntRange r : ranges) {
S in = joinSubList(tok, r);
S replaced = map.get(in);
if (replaced == null) continue with print("punctuation problem with " + quote(in));
replaceTokens(tok, r.start, r.end, replaced);
}
S s = join(tok);
print("All replacements applied: " + s);
}
L getReplacements() {
L l = dm_getConcepts(dm_require("#1026379/ELERecognitionReplacements"));
ret shallowCloneListToClass Replacement(l);
}
}