Warning: session_start(): open(/var/lib/php/sessions/sess_0nji8lab342jv7optrshb8roph, 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
/*
123 is a number
blubb is not a number
5$"%! is not a number
45 is a number
task 1: tokenize well (in this case, ignore quotes)
task 2: discover patterns "* is a number" and "* is not a number"
task 3: call pattern 1 positive, pattern 2 negative
task 4: make set of positive/negative example strings for argument
task 5a: learn description for positive examples, output new examples
task 5b: learn description for negative examples, output new examples
*/
cprint {
S input = [[
123 is a number
blubb is not a number
5$"%! is not a number
45 is a number
]];
start-thread {
// task 1: tokenize well (in this case, ignore quotes)
ITokenizer tokenizer = lambda1 splitAtSpaceTokenizer;
LLS tokenizedInput = map(s -> simpleSpacesAndTrim(tokenizer.tokenize(s)), tlft(input));
pnlStruct(+tokenizedInput);
// task 2: discover patterns "* is a number" and "* is not a number"
// (by finding best split point)
/*int minTokens = max(lambdaMap countCodeTokens(tokenizedInput));
print(+minTokens);
for (int i = 1; i <= minTokens; i++) {
Set patterns = ciSet();
for (LS tok : tokenizedInput)
patterns.add("* " + joinSubList(tok, indexOfCodeToken(i)));
print("Patterns for split point " + i + ": " + patterns);
}*/
int splitAtToken = 1;
Set patterns = patternsTreatingFirstNTokensAsVariable(splitAtToken);
print(+patterns);
assertEquals(2, l(patterns));
// task 3: call pattern 1 positive, pattern 2 negative
S posPattern = first(patterns), negPattern = second(patterns);
// task 4: make set of positive/negative example strings for argument
LS posExamples = mapNotNulls(tok -> getFlexMatchIC(posPattern, tok), tokenizedInputs);
LS negExamples = mapNotNulls(tok -> getFlexMatchIC(negPattern, tok), tokenizedInputs);
print(+posExamples);
print(+negExamples);
//task 5a: learn description for positive examples, output new examples
//task 5b: learn description for negative examples, output new examples
}
}