Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More !!word/ additions #1085

Merged
merged 16 commits into from
Jan 23, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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