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.:
This will match when the phrase appears anywhere in the input, e.g.:
Is it lunch time now?
** a QUOTED STRING, e.g.:
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").
So the second line will match e.g. these inputs:
That's cool \o/
You can even match quotes, like this:
This will only match a "hello" actually put in quotes by
** "OR" combination (comma)
matches when any of the elements is present in input.
So the example matches "this is fun" as well as
"I am enjoying this".
** "AND" combination (plus)
this + that
requires all elements to be present in input (in any order).
So the example 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 (exclamation mark in front)
great + !not
matches "this is great", but not "this is not that great".
** match START OF LINE only (with ^)
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:
matches just "ok" and nothing else. (See "typo" section
(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.:
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
Advanced features (not really used currently):
-add a weight to a sub-pattern:
download show line numbers
Travelled to 3 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx
No comments. add comment
|Eternal ID of this version:
|Public (visible to everyone):
|Archived (hidden from active list):
|Source code size:
||2966 bytes / 126 lines
|Pitched / IR pitched:
||No / No
|Views / Downloads:
||27 / 19
Formerly at http://tinybrain.de/1030319 & http://1030319.tinybrain.de