OverviewFilesCommitsIssuesDocsReleasesPeers

opencog-link-grammar / data / amy / 4.0.regex

55 lines · regex ref:
 %***************************************************************************%
 %                                                                           %
 %  Copyright (C) 2013 Linas Vepstas                                         %
 %  See file "LICENSE" for information about commercial use of this system   %
 %                                                                           %
 %***************************************************************************%

% The regexes here use the PCRE2 pattern syntax.
% The LG library must be configured with PCRE2 in order to use them.

% \X matches any Unicode grapheme. \x03  matches the internal representation
% of the dot in STEMSUBSCR (See 4.0.affix).
%
% For information on graphemes see: http://www.unicode.org/reports/tr29/

% Punctuation characters are getting strip from start and end of words,
% and words that contain punctuation are getting split at them.  See the
% "any/affix-punc" file.
% These punctuation characters will match here. The \x03 is to match
% subscripted punctuation that may be specified in this file.
ANY-PUNCT: /^[[:punct:]]+(:?\x03|$)/

% Multi-part random morphology: match any string as prefix, stem, or suffix.

MOR-STEM: /^\X+\x03=$/
MOR-PREF: /^\X+=$/
MOR-SUFF: /^=\X+/

% Reject anything that contains punctuation, so that the tokenizer will
% have a chance to split them off as affixes.
ANY-WORD: /^[^[:punct:]]+$/

% The regexes below don't need the PCRE2 regex library, but:
% 1. They work fine only with ASCII.
% 2. They are not checked to work fine with the latest changes
%    to the other configuration files.
% ANY-WORD: /^[[:alnum:]]+$/
% ANY-PUNCT: /^[[:punct:]].*$/  % The .* is to match an optional subscript.
% MOR-PREF: /^[[:alnum:]]+=$/
% MOR-STEM: /^[[:alnum:]]+.=$/
% MOR-SUFF: /^=[[:alnum:]]+$/

% Match anything that doesn't match the above.
% Match anything that isn't white-space.
% Well ... actually, reject anything that contains
% punctuation. We do this, so that the tokenizer can split off the
% the affixes (trailing commas, etc) correctly.
JUNK: !/[[:punct:]]/
JUNK: /^/

% How to debug:
% link-parser amy -m -v=10 -debug=anysplit.c
% If needed, you can add to -debug (comma separated) one of more
% from the following: separate_word,regex-morph.c,read-regex.c