🏛️<PrimaryInterface> Class Doc.
You can use the help function (?/help) at any time to view a list of available commands or to get detailed information about a specific command by adding a <command> .
| Tip: type 'help' to learn about any command.
| Tip: type '?' to learn about allowed actions.
-----------------------------------------------
03:31:21 ~ [es][b]@[Sin pudor(NA)]/[y1]: r
03:31:24 ~ [es][v]@[Caer en la cuenta(NA)]/[y1]: ls
(SYS: Started edit-session at 03:31:27)
Showing 2/2 results.
| 1. Darse cuenta | 2. Darse perfecta cuenta
>> mv 1 y2
>> y2
Showing 1/1 results.
| 1. Darse cuenta a
>> y1
Showing 1/1 results.
| 1. Darse perfecta cuenta
>> cd 1
03:31:56 ~ [es][v]@[Darse perfecta cuenta(NA)]/[y1]: edit lang en
Change applied successfully.
03:32:06 ~ [en][v]@[Darse perfecta cuenta(NA)]/[y1]: sug
(SYS: Started sug-session at 03:32:13)
| [es][v]@[Sobrentender(NA)] [Y/N] >>
| [es][v]@[Finiquitar(NA)] [Y/N] >> e2
| Succesfully binded node to 'e2' field.
| [es][v]@[Analizar(NA)] [Y/N] >> q
(SYS: Ended sug-session at 03:32:26)
03:32:06 ~ [en][v]@[Darse perfecta cuenta(NA)]/[y1]: e2
03:32:32 ~ [en][v]@[Darse perfecta cuenta(NA)]/[e2]: ls
(SYS: Started edit-session at 03:32:36)
Showing 1/1 results.
| 1. Finiquitar
>>
(SYS: Ended edit-session at 03:32:48)
03:32:32 ~ [en][v]@[Darse perfecta cuenta(NA)]/[e2]: Perro
| Successfully binded 'Perro'.
03:32:32 ~ [en][v]@[Darse perfecta cuenta(NA)]/[e2]: vg
| There are no examples.
>>
(SYS: Ended vg-session at 03:33:27)
03:32:32 ~ [en][v]@[Darse perfecta cuenta(NA)]/[e2]: pin
03:33:29 ~ [en][v]@[Darse perfecta cuenta(NA)*]/[e2]: details
| Synset sizes (y0 = 0, y1 = 2, y2 = 0)
| Semset sizes (e0 = 0, e1 = 0, e2 = 2)
03:33:29 ~ [en][v]@[Darse perfecta cuenta(NA)*]/[e2]: r -t v
03:33:42 ~ [es][v]@[Brasear(NA)]/[e2]:0. Overview
SK_Interface is a comprehensive command-line interface (CLI) designed to interact with a knowledge graph. It provides a wide range of functionalities including node navigation (cd), modification (grab, new), information display (ls, run), and settings management (set, unset), among others. This documentation details the usage and features of each command available in the SK_Interface.
1. Basic Commands
The cd command in the CLI facilitates navigation to different nodes within the graph.
When a user inputs cd followed by a node name, the system either (1st case) directly navigates to the node if there's an exact match, or (2nd case) presents a selection interface to choose from among multiple matching nodes. In cases where no exact match exists (due to misspelling), the CLI provides guessed options based on the input for user selection (3rd case).
To go back, we can write cd .. .
The r command is designed to select a random node from the graph, with the option to apply specific constraints.
Users can refine their search by specifying the language (using the -l option), the type of node (with -t), or toggle the selection to favorited nodes (using -f). This command allows for a more targeted random selection within the graph based on these specified parameters.
One added functionality in one of the latest revisions is the -s (--sos) command, which allows setting a bias to limit the number of connections of the nodes, so that a node filling session with few connections can be focused on."
Note that this commands are persistent.
For users who want to continuously travel to a specific type of nodes throughout their session, the -t and -l commands are designed to persistently set filters for node types and languages, respectively. This means filters remain active across commands until explicitly altered or cleared.
To adjust or clear these filters, users can issue r -t or r -l without accompanying arguments, effectively resetting the respective filter to its default state.
Here's an example of this behavior:
Instead of set <field>...
If a field is set rawly (y0), it will be set.
Instead of ls ; <name>...
If a name existing in the Graph is rawly set (Gallo), it will be added to the current field (it has to be only one selected).
The set and unset commands in the CLI are designed for configuring and clearing settings, respectively. The set command allows users to specify various settings, including field selections (like y0, y1, e2) and node characteristics (language and type, indicated by 2-character and 1-character codes, respectively).
If no specific settings are provided, it defaults to enabling all 'y' and 'e' prefixed fields. However, set will always clear the fielding for the current operation, no matter the parameters.
Conversely, the unset command is used to remove specific settings, functioning analogously to the set command but for clearing instead of setting parameters. If executed without any arguments, it removes all 'y' and 'e' prefixed fields, effectively resetting the field settings.
The ls command is used for listing information about the current node in the CLI, and it triggers the LS_Interface for an enhanced display. Bear in mind that if a single field is selected at placeholder, the ls command will trigger the LS_Interface, which allows for plenty of operations within a Node (mostly related about editing connections).
For more information, review the LS_Interface information at <AUX>_Interface Class Doc.
1. Functional Parameters
-l(--lang) and-t(--type)
We can instantly select the field we want to inspect by inputing it as an argument to the command.
We can decide wether to display results of a specific lang or type by using the adequate flags -l (--lang) or -t (--type) .
Note that this commands are persistent.
For users who want to continuously inspect a specific type of nodes throughout their session, the -t and -l commands are designed to persistently set filters for node types and languages, respectively. This means filters remain active across commands until explicitly altered or cleared.
To adjust or clear these filters, users can issue ls -t or ls -l without accompanying arguments, effectively resetting the respective filter to its default state.
Here's an example of this behavior:
2. Aesthetic Parameters
-d(--details)
For a detailed view of node information, utilize the -d or --details option. This flag is most effective when used alone, as it provides a comprehensive display of each node's details. The use of --width, --abbr, or --ncol in conjunction with this flag is not necessary, as --details already optimizes the display format for detailed information, overriding the need for specifying column width (--width), abbreviation length (--abbr), or the number of columns (--ncol).
-w(--width)
To customize the column width in the display, use the -w or --width option followed by your preferred width value. This setting allows you to adjust how much information fits across the screen.
Default for the system is set to width=35.
-a(--abbr)
For shortening node names, the -a or --abbr flag can be applied, followed by the maximum character length. This is useful for simplifying and tidying up the display, especially when dealing with longer node names.
-p(--stop)
To cap the number of nodes shown, the -p or --stop option can be utilized with a specified maximum count. This is particularly helpful for managing the quantity of data presented at once.
-c(--ncol)
For configuring the layout with a specific number of columns, use the -c or --ncol option, followed by the desired number of columns. This allows for a more structured and organized presentation of nodes.
Default for the system is set to ncol=4.
-r(--shuffle)
To randomize the order in which nodes are displayed, the -r or --shuffle option can be employed. This feature adds an element of variability and can be useful in viewing the nodes from different perspectives.
Shows the examples for the current placeholder node, if any, and enters the VG (from verbi gracia) pseudo-interface.
For more information, review the VG_Interface information at <AUX>_Interface Class Doc.
Shows the size of the fields for the current node.
2. Editing commands
Creating a node consists on writing new and filling some fields. And that's all actually.
We can edit the current node hash properties by using edit <hash_attr> <new_value> . In case the new hash configuration matched an already existing node, it merges them using the merge_nodes function from Graph implementation.
This command is designed to facilitate the suggestion process for connecting nodes within a network. By examining a specific node and its associated field, the command dynamically generates recommendations for potential connections, derived from the node's neighbors and their relationships.
Subcommands
Users are prompted to accept or reject suggestions dynamically, with the option to specify a particular field for binding or to exit the session.
Accepting Suggestions (
Yory):By responding with
Yory, the user indicates acceptance of the suggested connection using the current field under consideration. This action binds the current node to the suggested node, reinforcing the network's structure based on the predetermined logic specific to that field.
Rejecting Suggestions (
Norn):Responding with
Nornsignifies rejection of the current suggestion. The session then progresses to the next suggestion without making any changes to the network, allowing the user to skip suggestions that are deemed irrelevant or unhelpful.
Specifying a Field for Binding (
y0,y1, ...,e1,e2):The user can specify a particular field for the connection by entering one of the field codes (
y0,y1, ...,e1,e2). This advanced option allows for greater specificity in how nodes are connected, tailoring the network's evolution to the user's insight into the relational dynamics between nodes.
Exiting the Session (
qorexit):At any point, the user can choose to exit the suggestion session by entering
qorexit. This command immediately terminates the session, allowing the user to effectively conclude their interaction without proceeding through the entirety of the suggestions queue.
Algorithm Specific Logic
Field
y0:The command targets neighbors linked through the
y1relationship.It then explores these neighbors to find their connections via
y0, effectively looking one step beyond direct neighbors to suggest second-degree connections that share ay0link.
Field
y1:An extensive search is performed starting from neighbors connected by
y1.It identifies direct
y1neighbors, then explores theiry1neighbors, and further extends to those second-degree neighbors' owny1connections.Additionally, it considers the
y1connections ofy2neighbors and theyconnections ofeneighbors, prioritizing those with a centrality score above 35%, indicating strong relevance or intersection with the original node.
Field
y2:Focuses on the
y1neighbors of the current node, seeking out theiry2connections to suggest a broader but directly related network circle.
Fields
e0,e1,e2:These fields share a similar approach, tailored to the specific
evariant:The process starts by identifying
y1neighbors, then selecting their respectivee0,e1, ore2connections.Additionally, it looks into the
eneighbors of the current node and gathers theireconnections, broadening the scope of potential suggestions.
Sets the favorite hash attribute of the current node to either True or False by respectively calling the command pin or unpin . This will be useful when filtering nodes, to find the ones we love the most (for example, via r -f).
Favorite nodes are represented with an asterisk at the end of the compact representation.
Deletes from the graph the current node set at the placeholder.
3. Advanced Commands
The grab command in the CLI is versatile, offering two modes of operation. When used with an argument (i.e., grab [node_name]), it targets and grabs a specific node named in the argument. If the specified node doesn’t match any existing nodes, the command initiates a selection process, suggesting similar nodes for the user to choose from. When used without an argument (grab), it simply grabs the current node in the context.
Nodes can also be grabbed within the GB_Interface and the LS_Interface.
The grabbed command is designed to display all the nodes that have been grabbed so far and activates the GB_Interface. This interface is particularly useful for managing the nodes that are marked for use in subsequent operations, like the run command.
For more information, review the GB_Interface information at <AUX>_Interface Class Doc.
The run command works closely with the list of grabbed nodes. It incorporates all the display formatting options of the ls command, such as column width and order shuffling.
Additionally, it introduces the -f or --fielding flag, a boolean option that, when included, restricts the search to the nodes within the current fielding at the placeholder. Essentially, run executes a Density Search algorithm on the grabbed nodes, leveraging these formatting and fielding features for an optimized search experience.
The k parameter can be defined as a flag (1st case) or inputed when the function asks for it (2nd case). This is just a matter of ergonomy.
The save command is a straightforward utility for saving the current state of the graph. By default, it saves the file as 'data.txt', but it allows for customization of the filename by providing a different name as an argument (e.g., save custom_filename.txt), enabling users to easily manage multiple saved states or versions of their graph.
The do_term method provides an interactive Python terminal within the SK_Interface command-line environment. This feature is designed primarily for advanced users or administrators who need direct access to the underlying Python objects and methods for maintenance, debugging, or advanced customization.
Functionality
Access to SKComponents: provides direct access to SKComponents objects and methods. This includes immediate access to
NodeandGraph(G) objects, enabling advanced manipulation and querying capabilities within the system.NodeNode Representation: customize node displays using
Nodeclass methods likecompress,toggle_back_labels,expand, andtoggle.
Graph (G)Node Visualization and Interaction: find, select, and set nodes as variables with ease, including the use of the
random,findandselectmethods for random node selection.Graph Filtering: apply filters for targeted exploration using the
char_count,word_count,contains_word,contains,starts_withandends_withfilters.Editing: edit node properties such as name, type, lemma, language, and favorites, offering detailed control over node hash attributes through the
editcommand.
Enhanced User Experience: enjoy improved clarity in viewing longexamples and handling long names, thanks to the terminal's format.
Interactive Result Display: automatically print outputs of commands for an interactive experience, akin to a standard Python shell.
Database Operations: manually save the database to ensure all modifications are effectively captured and stored.
Simple Exit Mechanism:
Exit the terminal mode easily by typing
exit,quit, orq.
Warning on Safety
The do_term method, while a powerful tool within SK_Interface, poses significant risks due to its use of the exec function for executing arbitrary Python code. This capability could lead to unintended system alterations or security vulnerabilities if mishandled. Therefore, it is advised for use exclusively by administrators or knowledgeable users who fully grasp its implications. Caution is paramount, and it's recommended to employ this feature only in controlled and secure settings.
Last updated