Up
The plx
tool is an executable Perl script included with the PanLex tools. It includes several commands that are useful as part of the assimilation process. Commands may be invoked as plx <command>
. Some commands require additional arguments. You can run plx
with no arguments for a summary of the available commands and the environment variables that some commands depend on.
The summary of the environment variables is:
- PANLEX_TOOLDIR: full path to the
panlex-tools
directory. If you followed the PanLex tools installation instructions, you will already have this set. - PANLEX_ARCHIVE_USERNAME: username (provided by PanLex staff) for logging into the PanLex resource archive.
- PANLEX_ARCHIVE_PASSWORD password (provided by PanLex staff) for logging into the PanLex resource archive.
- PANLEX_ARCHIVE_NAME: your full name, to be used when uploading directories to the PanLex resource archive.
- PANLEX_ARCHIVE_EMAIL: your email address, to be used when uploading directories to the PanLex resource archive.
- PANLEX_PANLEM_USER: your PanLem username or numeric user ID. (The numeric user ID may be retrieved by logging into PanLem, visiting the person: see page, and using the value for number.)
- PANLEX_PANLEM_PASSWORD: your PanLem hashed password. It may be retrieved by logging into PanLem, visiting the person: see page, and using the value for password — auxiliary.
You can set these environment variables in the same manner as described in the PanLex tools configuration instructions. The basic line to add to your .bash_profile
is:
export VARIABLE="value"
where you should replace VARIABLE with one of the variables above, and value with its value.
Commands
cp
This command lets you copy certain files from the PanLex tools directory into the current directory. Its first argument is the name of the file to copy. For example, the command plx cp serialize.pl
will copy serialize.pl
to the current directory. It will also automatically change the BASENAME
variable value to match the source. The second argument is optional and specifies the name of the copied file in the current directory; if unspecified, it will be the same as the original file.
This command looks for files in the following panlex-tools
subdirectories: serialize
, serialize/data
, and tabularize/*
. If you omit the .pl
extension, it will automatically be supplied. Copied tabularization scripts are named based on the current directory name by default.
edit
This command lets you request editorship of a PanLex source through PanLem. It takes one argument, which must be either a source label or source ID. The result depends on your account’s permission level on PanLem. For some users (generally PanLex staff members) the request will be approved automatically; for others (generally interns and volunteers) it will be submitted for manual approval.
For this command to work, you must set the PANLEX_PANLEM_USER and PANLEX_PANLEM_PASSWORD environment variables.
fetch
This command downloads a zip file containing a directory from the resource archive, unzips it into the current directory, and deletes the zip file. Its argument must be either the name of a resource directory, a source label, or a source ID. If it is a source label or ID, the resource directory will be determined using the PanLex API.
For this command to work, you must set the PANLEX_ARCHIVE_USERNAME and PANLEX_ARCHIVE_PASSWORD environment variables. You must also have the unzip
command available.
submit
This command submits a final source file to PanLem. With no arguments, it looks for a final source file in the current directory and performs a replace
operation (i.e., it replaces the PanLex source’s content with the file’s content). This behavior can be modified with additional arguments. You can specify the final source file path; the operation, with replace
, add
, or check
; and the source ID or source label. The order of arguments is arbitrary, except that the final source file path (if present) must be the first argument.
If you do not pass a source ID, it will be looked up automatically via the PanLex API, either from the source label you passed or from a source label inferred from the current directory name.
For this command to work, you must set the PANLEX_PANLEM_USER and PANLEX_PANLEM_PASSWORD environment variables.
upload
This command uploads a directory to the resource archive. It takes three arguments: the flag -r
(indicating that the directory contains an unanalyzed resource rather than an analyzed source), the directory path (relative or absolute), and a note to attach to the upload. The first two arguments are optional. If the first argument is omitted, the directory is uploaded as an analyzed source. If the second argument is omitted, the current directory is uploaded.
For this command to work, you must set the PANLEX_ARCHIVE_USERNAME, PANLEX_ARCHIVE_PASSWORD, PANLEX_ARCHIVE_NAME, and PANLEX_ARCHIVE_EMAIL environment variables. You must also have the zip
command available.