class chart : int -> int -> object end
Represents the chart for a chart parser.
nc
: Number of categories in the grammar being used.
sl
: Length of the sentence being parsed.
method set_cat_info : int -> int -> int array -> unit
Sets the tree depth and search order for the category cat
.
Returns nothing
cat
: A category (1 <= cat
<= nc
)
arity
: The arity (dimension) of the category
order
: The order to insert/lookup items of this category.
For example, [|0;2;1;3|]
would mean the trie for cat
is
arranged with the 0th state first, then the 2nd state, then the
1st state, and finally the 3rd state (it is a map from the 0th
state to a map from the 2nd state to a map from the 1st state to
a set containing the 3rd state.)
method show_cat_info : unit -> unit
Displays the chart indexing information.
Returns nothing
method chart_size : int
Returns the number of items in the chart
method matches : int -> subitem -> subitem list
Returns a list of all items of category cat
that match the
specification of item
-- here, anything matches where
a field in item
is -1, and all other values must match
exactly.
cat
: Category of the item to match
item
: States of the item to match, where a state can be -1 to
match any state.
method contains : int -> subitem -> bool
Returns whether the exact item <cat
,item
> exists in the chart
cat
: Category of item to find
item
: States of item to find
method add : int -> subitem -> bool
Adds an item to the chart, if it isn't already there.
Returns whether the item was actually added or not (this would be false
if the item was already present in the chart)
cat
: Category of item to add
item
: States of item to add