Bases: Memory
A memory that can have a parent and children Links,
forming a hierarchical structure of interconnected memories.
The content can be either a [Notion][silverlingua.core.molecules.notion.Notion] or a [Memory][silverlingua.core.atoms.memory.Memory].
(You can still use the content as a string via str(link.content).)
content
instance-attribute
parent
class-attribute
instance-attribute
children
class-attribute
instance-attribute
path
property
Returns the path from the root to this Link.
root
property
Returns the root Link of this Link.
depth
property
Returns 1 based depth of this Link.
is_root
property
Returns whether this Link is a root Link.
is_leaf
property
Returns whether this Link is a leaf Link.
is_branch
property
Returns whether this Link is a branch Link.
path_string
property
Returns the path from the root to this Link as a string.
Example:
"root>child>grandchild"
add_child
add_child(child: Link) -> None
Source code in src/SilverLingua/core/molecules/link.py
| def add_child(self, child: "Link") -> None:
self.children.append(child)
child.parent = self
|
remove_child
remove_child(child: Link) -> None
Source code in src/SilverLingua/core/molecules/link.py
| def remove_child(self, child: "Link") -> None:
self.children.remove(child)
child.parent = None
|