dictionary_tree (library)
Author(s): Göran Smedbäck.
This module offers a dynamic tree structured dictionary a bit combined with predicates that gives it the useability to be the dictionary for the parser.
Usage and interface
- Library usage:
:- use_module(library(dictionary_tree)). - Exports:
- Imports:
- System library modules:
aggregates, dynamic, iso_misc, iso_byte_char, iso_incomplete, operators, read, write, terms_check, terms_vars, cyclic_terms, lists, provrml/internal_types. - Packages:
prelude, nonpure, assertions, isomodes, regtypes, iso, dcg.
- System library modules:
Documentation on exports
Usage:create_dictionaries(Dictionary)
Returns a dictionary. A general name was used if the user would like to change the code to include more dictionaries.
- Call and exit should be compatible with:
(internal_types:dictionary/1)Dictionary is a dictionary. - The following properties should hold at call time:
(term_typing:var/1)Dictionary is a free variable.
Usage:is_dictionaries(Dictionary)
Is the argument a dictionary is solved by this predicate.
- Call and exit should be compatible with:
(internal_types:dictionary/1)Dictionary is a dictionary.
Usage:get_definition_dictionary(Dictionary,Tree)
Returns the definition dictionary (for the moment there is only one dictionary), which is a tree representation.
- Call and exit should be compatible with:
(internal_types:dictionary/1)Dictionary is a dictionary.
(internal_types:tree/1)Tree is a tree structure. - The following properties should hold at call time:
(term_typing:nonvar/1)Dictionary is currently a term which is not a free variable.
(term_typing:var/1)Tree is a free variable.
Usage:get_prototype_dictionary(Dictionary,Tree)
Returns the prototype dictionary (for the moment there is only one dictionary), which is a tree representation.
- Call and exit should be compatible with:
(internal_types:dictionary/1)Dictionary is a dictionary.
(internal_types:tree/1)Tree is a tree structure. - The following properties should hold at call time:
(term_typing:nonvar/1)Dictionary is currently a term which is not a free variable.
(term_typing:var/1)Tree is a free variable.
Usage:dictionary_insert(Key,Type,Field,Dictionary,Info)
The predicate will search for the place for the Key and return Info, if the element inserted had a post before (same key value) multiple else new. The dictionary is dynamic and do not need output because of using unbinded variables.
- Call and exit should be compatible with:
(basic_props:atm/1)Key is an atom.
(basic_props:atm/1)Type is an atom.
(basic_props:term/1)Field is any term.
(internal_types:tree/1)Dictionary is a tree structure.
(basic_props:atm/1)Info is an atom. - The following properties should hold at call time:
(term_typing:nonvar/1)Key is currently a term which is not a free variable.
(term_typing:nonvar/1)Type is currently a term which is not a free variable.
(term_typing:nonvar/1)Field is currently a term which is not a free variable.
(term_typing:nonvar/1)Dictionary is currently a term which is not a free variable.
Usage:dictionary_lookup(Key,Type,Field,Dictionary,Info)
The predicate will search for the Key and return Info;defined or undefined accordingly. If defined the fields will be filled as well. The predicate do not insert the element.
- Call and exit should be compatible with:
(basic_props:atm/1)Key is an atom.
(basic_props:atm/1)Type is an atom.
(basic_props:term/1)Field is any term.
(internal_types:dictionary/1)Dictionary is a dictionary.
(basic_props:atm/1)Info is an atom. - The following properties should hold at call time:
(term_typing:nonvar/1)Key is currently a term which is not a free variable.
(term_typing:nonvar/1)Dictionary is currently a term which is not a free variable.
(term_typing:var/1)Info is a free variable.
Usage:merge_tree(Tree,Tree)
The predicate can be used for adding a tree dictionary to another one (the second). It will remove equal posts but posts with a slight difference will be inserted. The resulting tree will be the second tree.
- Call and exit should be compatible with:
(internal_types:tree/1)Tree is a tree structure.
(internal_types:tree/1)Tree is a tree structure. - The following properties should hold at call time:
(term_typing:nonvar/1)Tree is currently a term which is not a free variable.
(term_typing:nonvar/1)Tree is currently a term which is not a free variable.