%
% demo-dict-mpg -- Demo dictionary for disjunct parsing
%
% Configuration file for an Atomspace-based dictionary. It will use
% disjunct data in the AtomSpace to perform (conventional) parsing.
% If appropriate disjuncts cannot be found in the dictionary, (that is,
% if a complete parse is not possible), then word-pairs will be used
% to supplement the disjuncts.
%
% All config values can be left as-is; nothing here needs tweaking.
%
% See the `demo-atomese/storage.dict` file in the main Link Grammar
% distribution for detailed documentation.
% -----------------------
% Boilerplate: The dictionary is for English, the English locale
% should be used, and a version number.
#define dictionary-lang en;
#define dictionary-locale en_US.UTF-8;
#define dictionary-version-number 5.12.4;
% Use a copy of the database; we assume the CogServer is running and
% is using the "main" version.
#define storage-node "(RocksStorageNode "rocks:///home/opencog/data/mpg-parse-copy.rdb")";
% Alternative: access the CogServer from outside the container:
% #define storage-node "(CogStorageNode "cog://localhost:17003")";
% -----------------------
% Enable use of sections (disjuncts).
#define enable-sections 1;
% Decorate sections with extra pairs, to fill in for missing connectors.
% Allow up to 2. Decorate sections with extra ANY connectors, as well.
% High costs will make these unlikely to be used in parses.
#define extra-pairs 2;
#define extra-any 1;
% Location where disjunct costs are stored. The cost will be obtained
% from the floating point value located at the `cost-key` Value on the
% Sections. It's assumed that this is a FloatValue, which is a vector;
% the index specifies the location in this vector.
#define cost-key "(Predicate "*-Mutual Info Key cover-section")";
#define cost-index 1;
% If the value at the key+index above is less than this cutoff,
% the Section will not be added to the local dictionary.
% In this example, the raw cost is the MI, and MI of less than
% 4 will be rejected.
#define cost-cutoff 4.0;
% Sections with a missing cost will be assigned this default. To
% ignore sections with a missing cost, set it to some value less
% than `cost-cutoff`.
#define cost-default 4.01;
% The cost used by LG will be a linear rescaling of the raw data above.
% The rescaling is y=mx+b where m==`cost-scale` and b==`cost-offset`
% and x== the value fished out of the vector above.
%
% The scale factor is negative, so as to flip the sign on the costs.
% In the demo dictionary, the costs are provided by the MI, which is
% "better", the more positive it is. The LG costs, however, are
% "better" when they are smaller (less positive). Thus, a sign-flip
% is called for.
#define cost-scale -0.25;
#define cost-offset 3.0;
% Disjuncts with a cost larger than this will not be used during
% parsing. This can be over-ridden with the !cost-max parser option.
% This applies both to the available disjuncts, and the ones created
% dynamically, from pairs.
%
% A disjunct can be supplemented with N=`extra-pairs` pairs. Each pair
% can have a cost of at most 1.0. So it's reasonable to accept a max
% disjunct cost of 3+2=5
#define max-disjunct-cost 5.0;
% No more than this many disjuncts will be created for a word. If the
% dictionary encodes for more than these, then disjuncts will be
% selected randomly, to not exceed this limit. The selection is applied
% after the above cost-max limit, and after some pre-pruning that avoids
% the selection of disjuncts that cannot possibly be used.
#define max-disjuncts 75000;
% -----------------------
% Pair config.
%
% Novel sentences containing rarely-seen words might not be parsable,
% even when the sections on them are decorated with extra connectors.
% In this case, fall back to MST-style parsing, and create disjuncts
% consisting of connectors obtained entirely from word-pairs.
%
% Allow disjuncts with up to two word-pair connectors.
#define pair-disjuncts 2;
% Location where pair MI values are stored.
#define pair-predicate "(BondNode "ANY")";
#define pair-key "(Predicate "*-Mutual Info Key-*")";
#define pair-index 1;
% For small dictionaries, an MI of zero or more should be allowed, as
% otherwise there are just not enough pairs, and the ANY link starts
% getting used. For larger dictionaries, an MI of 4 or larger makes
% sense.
#define pair-cutoff 0.0;
% If there's no MI, just reject it. (Negative MI's are bad.)
#define pair-default -10;
% Map the MI interval [0,4] to [1,0]. Thus, any MI of more than 4
% gets a negative cost and encourages loop formation. Links with an
% MI of less than 4 will get used, to "plug the hole", if there's
% nothing better.
#define pair-scale -0.25;
#define pair-offset 1.0;
% Keep in mind that the parser ranks parses from lowest to highest cost.
% If word-pair links have a negative cost, the parser is incentivized to
% add as many of these as possible, while still resulting in a planar
% graph with many loops. Viz, "Maximal Planar Graphs" (MPG). Conversely,
% if word-pair links have a positive cost, Minimal Spanning Trees (MST)
% will be created (minimizing the total cost.)
% Enable supplementation of pure pair-only disjuncts with "ANY" links.
#define pair-with-any 1;
% Default cost for `ANY` link types. The `ANY` link type is meant to
% provide a desperate, last-chance opportunity to link to a word that
% cannot otherwise link with disjuncts or word-pairs. It is given a
% high cost, so that it is not used when other links are available.
#define any-default 2.6;
% Enable expressions that consist entirely of "ANY" link-types.
#define any-disjuncts 1;
% Enable the automatic generation of <UNKNOWN-WORD>. It will be
% automatically added to the dictionary, with multi-ANY connectors
% on it. The ANY connectors will be used, irresepctive of the other
% `any` setting above.
#define enable-unknown-word 1;
% -----------------------
% Bogus entry. Cannot be empty.
foo: UNITS+;