Skip to content

Commit

Permalink
Merge pull request #1085 from ampli/disj-prt
Browse files Browse the repository at this point in the history
More !!word/ additions
  • Loading branch information
linas authored Jan 23, 2020
2 parents e695e28 + 4fa0843 commit 37e493c
Show file tree
Hide file tree
Showing 8 changed files with 453 additions and 233 deletions.
23 changes: 18 additions & 5 deletions data/command-help-en.txt
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ Examples:

[!]
This command is for debugging the dictionary or the library.
It gets as an argument a word, and optionally a regex and flags.
It gets as an argument a word, and optionally a regex and/or flags.
It splits the given word to tokens according to the current language,
and for each token it prints its matching dictionary words along with its
expression or disjunct list. The word may include a wildcard * to find
Expand All @@ -331,15 +331,28 @@ Show also low-level memory details of the expression:
Show the disjuncts (without duplicates):
!!test.n//

Show disjunct connector expression source macros:
!!test.n//m

The above command is more useful for a single disjunct (1234 is an example
for a disjunct number, see below for disjunct print format):
!!test.n/1234/m

Show selected disjuncts according to the supplied regex:
!!test.n/ Wd .*<-->.*@M\b/
!!test.n/ Wd-.*<-->.*@M\+/
!!test.n/ J[sk]- D[\w*]+c\-/

Show selected disjuncts according to the supplied string (supposing the regex
engine is PCRE, which supports "\Q"):
!!test.n/\Q Ds**x+/

Display all the words that start with "test":
!!test*

Display all the words that start with "test" and have subscript ".q":
!!test*.q


A sample output of a disjunct-list display:
Token "test.n" matches:
test.n 8509 disjuncts <en/words/words.n.1-const>
Expand All @@ -348,15 +361,15 @@ A sample output of a disjunct-list display:
test.n 4273/4501 disjuncts

...
test.n: [4070]1.500= Wd @hCO Ds**c <--> Ss*s @M NM
test.n: [3493]2.600= @AN- @A- Ds**x- <--> NM+ R+ Bs+ Bsm+
...

In the this sample output:
8509 Number of disjuncts in the dictionary expression.
4501 Number of disjuncts after applying cost-max.
4273 Number of disjuncts w/o duplicates.
4070 Disjunct ordinal number.
1.500 Disjunct cost.
3493 Disjunct ordinal number.
2.600 Disjunct cost.
= A separator to enable regex anchoring.
<--> A separator of the "-" (LHS) and "+" (RHS) connector lists.

Expand Down
7 changes: 4 additions & 3 deletions link-grammar/connectors.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,16 +120,17 @@ struct Connector_struct
the power pruning. */
uint8_t prune_pass; /* Prune pass number (one bit could be enough) */
bool multi; /* TRUE if this is a multi-connector */
int tracon_id; /* Tracon identifier (see disjunct-utils.c) */
int32_t tracon_id; /* Tracon identifier (see disjunct-utils.c) */
const condesc_t *desc;
Connector *next;
union
{
const gword_set *originating_gword; /* Used while and after parsing */
/* For pruning use only */
struct
{
int refcount; /* Memory-sharing reference count */
int32_t refcount;/* Memory-sharing reference count - for pruning. */
uint16_t exp_pos; /* The position in the originating expression,
currently used only for debugging dict macros. */
bool shallow; /* TRUE if this is a shallow connector.
* A connectors is shallow if it is the first in
* its list on its disjunct. (It is deep if it is
Expand Down
Loading

0 comments on commit 37e493c

Please sign in to comment.