base ¶
AbstractSpace ¶
A virtual base class upon which Spaces can be implemented in Python
Source code in python/hyperon/base.py
GroundingSpace ¶
Bases: AbstractSpace
A wrapper over the native GroundingSpace implementation, which can be subclassed and extended within Python
Source code in python/hyperon/base.py
GroundingSpaceRef ¶
Bases: SpaceRef
A reference to a native GroundingSpace, implemented by the MeTTa core library.
Source code in python/hyperon/base.py
__del__ ¶
__eq__ ¶
add_atom ¶
atom_count ¶
copy ¶
get_atoms ¶
Returns a list of all Atoms in the Space, or None if that is impossible.
Source code in python/hyperon/base.py
get_payload ¶
Returns the Space object referenced by the SpaceRef, or None if the object does not have a direct Python interface.
query ¶
Performs the specified query on the Space, and returns the result as a BindingsSet.
remove_atom ¶
replace_atom ¶
Replaces the specified Atom, if it exists in the Space, with the supplied replacement.
subst ¶
Performs a substitution within the Space, based on a pattern and a template.
Interpreter ¶
A wrapper class for the MeTTa interpreter that handles the interpretation of expressions in a given grounding space.
NOTE: This is a low-level API, and most applications would be better served by a MeTTa runner object
Source code in python/hyperon/base.py
SExprParser ¶
A class responsible for parsing S-expressions (Symbolic Expressions). This class wraps around a SExprParser object from the core library.
Source code in python/hyperon/base.py
parse ¶
Parses the S-expression using the provided Tokenizer.
Source code in python/hyperon/base.py
parse_to_syntax_tree ¶
Parses the S-expression into a SyntaxNode representing the top-level of a syntax tree.
SpaceRef ¶
A reference to a Space, which may be accessed directly, wrapped in a grounded atom, or passed to a MeTTa interpreter.
Source code in python/hyperon/base.py
__del__ ¶
__eq__ ¶
add_atom ¶
atom_count ¶
copy ¶
get_atoms ¶
Returns a list of all Atoms in the Space, or None if that is impossible.
Source code in python/hyperon/base.py
get_payload ¶
Returns the Space object referenced by the SpaceRef, or None if the object does not have a direct Python interface.
query ¶
Performs the specified query on the Space, and returns the result as a BindingsSet.
remove_atom ¶
replace_atom ¶
Replaces the specified Atom, if it exists in the Space, with the supplied replacement.
subst ¶
Performs a substitution within the Space, based on a pattern and a template.
SyntaxNode ¶
Tokenizer ¶
A class responsible for text tokenization in the context of Hyperon. This class wraps around a Tokenizer object from the core library.
Source code in python/hyperon/base.py
__del__ ¶
register_token ¶
Registers a new custom Token in the Tokenizer based on a regular expression.
Parameters:
regex: A string representing the regular expression to match incoming text. Hyperon uses the Rust RegEx engine and syntax. constr: A constructor function for generating a new atom when the regex is triggered.
Source code in python/hyperon/base.py
atom_is_error ¶
check_type ¶
Checks whether the given Atom has the specified type in the given space context.
Parameters¶
gnd_space: A pointer to the space_t representing the space context in which to perform the check atom: A pointer to the atom_t or atom_ref_t representing the atom whose Type the function will check type: A pointer to the atom_t or atom_ref_t representing the type to check against
Source code in python/hyperon/base.py
get_atom_types ¶
Provides all types for the given Atom in the context of the given Space.
interpret ¶
Parses the given expression in the specified grounding space.
Source code in python/hyperon/base.py
validate_atom ¶
Checks whether the given Atom is correctly typed.
Parameters¶
gnd_space: A pointer to the space_t representing the space context in which to perform the check atom: A pointer to the atom_t or atom_ref_t representing the atom whose Type the function will check
Returns¶
True if the Atom is correctly typed, otherwise false