Text processing

Allikas: Minority Translate
Main page | Why use it? | Features | Video tutorials | Workflow | Languages | Development | Download | Text corpus | Text processing | Contact
Pull example
Pull example configuration

Text processing changes the article text when using the pull function to transfer it from the source article to the destination article. It is mainly used to simplify repetitive tasks like replacing elements in the wikitext, but it can also be used together with the Apertium machine translation plugin to give content translation suggestions.

Processing is done in two steps: collecting parameters from the source text and making replacements. During the second step the collected parameters will be inserted into the replace strings.

Collecting

Collecting uses the pattern in the find column to extract parameters. Parameter names are specified in the parameters column. Those names can be used during the replace step to retrieve the extracted value. To avoid non-parameters being replaced, the parameters should be named <parameter_name>. Multiple parameter names can be specified by using ; to separate their names.

If the destination article has a title, special parameters <Src_title> and <Dst_title> are initialised with source and destination article title. In addition, <src_title> and <dst_title> are set to titles with first lowercase letter.

Replacing

Replace finds the pattern in the find column and replaces it with the string in the replace column. Before the replace is done, the parameters in the replace string are initialised with their values (if the value was found).

Filter column

Filter column is used by both collect and replace to determine which collects and replaces are applied. The syntax is source-language-code ; destination-language-code. If the language code is left empty, the filter will accept any value.

Find column

Both collect and replace use the same algorithm for finding text.

Symbol Meaning Example
# Extracts a parameter (terminated by punctuation or line end) published in #
@ Extracts a parameter (terminated by line end) largest_city = @
~ Any text <!--~-->
_text_ Only accept whole words, word beginnings (text_) or word endings (_text) pedia_