This page is obsolete, please go to https://github.com/Bibliome/alvisnlp/wiki/Shell¶
Shell¶
Introduction¶
The AlvisNLP/ML Shell is an console that allows you to evaluate Element Expressions interactively. The Shell is useful to explore the corpus annotations and to debug your plans.
How to invoke the shell¶
The Shell
module¶
Add a module of class Shell in your plan at the point where you want to explore the corpus.
The -shell
command line option¶
If you launch AlvisNLP/ML with the -shell
option, then it will open the shell after the corpus has been processed by the whole plan.
How to interact with the shell¶
The shell will diqplay a prompt (">
", by default) and wait for a command. If you type an expression, then it will be evaluated and the result displayed. For example:
> documents
can produce the following output:
Document: 9795118 Document: 7797557 Document: 9353924 Document: 8419299 Document: 9826772 Document: 9701599 Document: 9852010 Document: 9786190 Document: 9988713 Document: 9671823 Document: 9805371 Document: 9811636 Document: 100614 Document: 9680198 ...
Each line represents an element of the result set and indicates the type of the element (Document
) and its identifier. The Shell may evaluate any type of expression:
> number(documents)
may produce the following output:
375.0
After the Shell has evaluated an expression and printed the result, it is ready for the next one...
In order to leave the shell, type Ctrl-D
.
Shell commands¶
The general syntax for the Shell is the following:
> [@command] [expression]
@command
is a Shell command, when it is omitted, then it is an expression query by default.expression
is the command's operand. The operand is optional or mandatory depending on the command.
@query
expression¶
This command evaluates expression
with the current context element and displays the result. AlvisNLP/ML tries its best to guess the most sensible evaluation type.
The expression
operand is mandatory.
@move
expression¶
This command evaluates expression
as a list of elements and uses the first one as the context element for the following commands. When the shell is opened, the default context element is the corpus. In order to get back at the corpus, simply type:
> @move corpus
Subsequent @next
and @prev
commands will navigate along the elements of the result set.
The expression
operand is mandatory.
@next
¶
For the following commands, the shell uses the next element from the result of the last @move
command as the context element.
This command accepts no operand.
@prev
¶
For the following commands, the shell uses the previous element from the result of the last @move
command as the context element.
This command accepts no operand.
@features
[expression]¶
This command evaluates expression
as a list of elements and prints all features of each one.
If expression
is omitted, then the shell prints all features of the current context element.