The LPMN CLI Tool is a tool for communicating with the LPMN query server via the command line on a local computer. It should be downloaded before launching.
It allows for text processing according to the selected LPMN query and calling selected NLP CLARIN-PL service by indicating in the query the appropriate text processing tools for it.
Working with the LPMN CLI Tool requires basic command line skills.
To use the LPMN CLI Tool, you need to:
Download the LPMN CLI Tool using pip – the Python project manager. To do so please enter the following command in the command line:
pip install --extra-index-url https://pypi.clarin-pl.eu/simple/ lpmn_client_biz
A successful download should end with a message providing information about the downloaded version of the program:
Successfully installed lpmn_client_biz-2.*
To verify if the program has been downloaded correctly please enter the following command in the command line:
lpmn_client_biz
If the program has been downloaded correctly, the following information will be displayed:
usage: lpmn_client_biz [-h] [-v] [-it {text,file,file_id}] [-o OUTPUT] [-ot {text,file,file_id}] [-f FILENAME] [-t TIMEOUT] [-u USERNAME] [-p PASSWORD] [--url URL] [-c CONFIG] lpmn input
To run the LPMN CLI Tool, please enter a syntactically correct command with an lpmn query in the command line. For example:
lpmn_client_biz ['any2txt','morphodita',{'liner2':{'model':'n82'}}] "The cat is on the mat" -u username@pwr.edu.pl -p "my&password72" -ot text -v
A command containing a text processing pipeline should include the following elements:
lpmn_client_biz – the name of the program being run
Positional arguments – required elements, they must be entered in the given order:
['any2txt','morphodita',{'liner2':{'model':'n82'}}]
"The cat is on the mat"
or introduced in the form of a path to a file on a local computer, or a path on a server. If you provide a path to a file or on a server, it is required to define in the command the option -it file/file_id
. Providing text directly in the command does not require defining additional options, as the text is downloaded by default.Options – additional elements, their order is irrelevant, they can be entered or not depending on the task:
-h
– help
-v
– verbose mode. It prints detailed information about the process of performed operations in the form of, among others, a progress bar, so it is known what part of the task has been processed.
-it
– defines the type of input data according to three possibilities:
text
– text to be processed enclosed in quotation marks entered into the command e.g. "The cat is on the mat"
. This is the default option, so it does not require additional defining in the command.file
– path to a file, directory or .zip file on a local computer containing input data. It requires defining in the command as: ~\plik.txt -it file
. The type of input data depends on the text processing tools used.file_id
– path on the server to input data downloaded from the server e.g. as a result of a previous task.-o
– defines the name of the directory in which the processing results will be saved e.g. -o Task1
. If the directory does not exist, it will be created. It is also possible to indicate the path to the directory e.g. ~\Desktop\LPMN\Outputs\Task1
. If the given path does not exist, it will also be created, and the output data will be saved in the final directory.
-ot
– specifies the type of output data. Similarly to input data, there are three types of output data:
text
– displays in the command line the result of text processing, requires defining as -ot text
file
– downloads a file with the result of processing to a local computer, this is the default optionfile_id
– path on the server to output data. The output file is not downloaded, but its path on the server is returned. Requires defining as -ot file_id
.-f
– allows you to define the name of the downloaded file with processing results. Entering in the command: -f result.xml
will create a .xml file named result, which will contain the processing results. Lack of a defined -f
will result in the creation of a default file name. The file is saved in the directory defined by -o
.
Note: Some LPMN tools, e.g. TermoPL, return output data in the .zip file. In this case, entering -f result.xml
will not create a .xml file, but result.zip.
-t
– time limit for task execution. By default, the program will stop after performing all operations, so the option does not require additional defining. In the case of large operations, you can set a time limit in seconds e.g. -t 10
. If the time limit is set and exceeded, and the processing is not completed, the task will be cancelled and an error message will be displayed.
-u
– username as in the login data to the CLARIN-PL website e.g. -u username@pwr.edu.pl
. It has to be defined in the command.
-p
– user password as in the login data to the CLARIN-PL website e.g. -p my&password72
. It has to be defined in the command.
Note: Some special characters require the use of quotation marks: -p "my&password72!"
.
Note: If you authenticate via the -u
and -p
options, they should be defined in the command.
-c
– configuration. It allows users to authenticate by using their login data to the CLARIN-PL website stored on a local computer without the need to enter them in the command.
If the config.yml
file is saved in any location, the path to the file should be defined in the command using e.g. -c ~\Desktop\LPMN\config.yml
.
Defining the path is not required when the file is saved:
C:\Users\username
. If lpmn_client_biz is run from this location, the current directory is username. The current directory can be changed by running lpmn_client_biz from a different location.C:\Users\username\AppData\Local\.clarin\config.yml
.The preparation of input data depends on the selected text processing services. They can be provided in the form of text in the command, a path to a file/directory/.zip file, or a path on the server.
The location of the downloaded file with output data depends on the output data settings. If the -o
option is defined, the file will be downloaded to the specified directory. If not, the file will be downloaded to the current working directory.
In Windows, when running the command line, the default user location is C:\Users\username. If lpmn_client_biz is run from this location, it is the default download location. You can change it by running lpmn_client_biz from a different location.
The processing results will also be available on the list of completed tasks on the page. To download it, you need to log in to CLARIN-PL and select the Task List option in the side menu. To go to the list of successfully completed tasks, select the Completed option. Downloaded results will be saved on the local computer in the Downloads directory.
The type of output data depends on the selected text processing services.
You can check the version number of the tool you are currently using with the command:
pip show lpmn_client_biz
while the command:
pip install -U --extra-index-url https://pypi.clarin-pl.eu/simple/ lpmn_client_biz
will update the LPMN CLI Tool to the latest available version. You can check for updates by comparing your local version number with the latest one available on the PyPI server.
Once you have finished working with the LPMN CLI Tool and will not need it in the future, you can remove it using the command:
pip uninstall lpmn_client_biz
You will need to confirm the action by typing the letter y
– yes in the command line. To cancel the removal, type n
– no.
If pip does not have an alias added as pip3, all the following commands starting with pip should be entered as pip3.
Detailed information about working in Linux is available in the document LPMN Client. Users Guide in chapter [4] LPMN CLI Tool in Linux.
(C) CLARIN-PL