Warning: session_start(): open(/var/lib/php/sessions/sess_a5q9ve8j1eb3tqrrf8tucnqtkn, 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
PhraseCache is a simple language for matching user input.
(see also https://PhraseCache.best)
A PhraseCache expression can consist of:
-just a word or phrase, e.g.:
school
lunch time
This will match when the phrase appears anywhere in the input, e.g.:
Is it lunch time now?
-a quoted string, e.g.:
"q&a"
"\o/"
These strings can contain any special character. They are
matched exactly character-by-character, but are
case-insensitive. The pattern does not match when it's part
of a bigger word (e.g. the first example would not match
the input "faq&answers").
You can even match quotes, like this:
"\"hello\""
This will only match a "hello" put in quotes by the user.
-"or" combination
fun, enjoying
matches "this is fun" as well as "I am enjoying this".
-"and" combination
this + that
matches "this and that" and "that or this", but not
"this one" or "that one".
"and" takes precedence over "or", so:
the + solution, a + resolution
is the same as:
(the + solution), (a + resolution)
(See "bracketing" below.)
-negation
great + !not
matches "this is great", but not "this is not that great".
-match start of line only (with ^)
^hello bot
will match "hello bot friend", but not "oh hello bot".
-match end of line only (with $)
please do this$
will match "now please do this", but not "please do this now".
Start of line and end of line can be combined like this:
^ok!$
matches just "ok" and nothing else. (See "typo" section
below.)
-bracketing (grouping)
(quick, fast) + (solution, resolution)
will match "we need a fast solution" as well as "the
resolution should be quick".
-disallow typos with exclamation mark, e.g.:
hi!
By default, PhraseCache has a crude typo detection system
that allows one typo (1 character added, removed or inserted
per input row). It's a cool feature, but arguably could see
some improvement. For naive patterns, it sometimes fails
badly, e.g. input "I" will also match the pattern "hi".
To circumvent this, add an exclamation mark AFTER the phrase
in question. (Not before the phrase as that would mean
negation.)
Advanced features (not really used currently):
-add a weight to a sub-pattern:
(foo, bar)*0.5