$ afasi versionFuzz a language by mixing up only few words. version 2021.10.22
General Help
$ afasiUsage: afasi [OPTIONS] COMMAND [ARGS]... Fuzz a language by mixing up only few words. The translation table entries are applied in order per line of input. So, with large translation tables the performance will obviously degrade with a power of two. The latter should be taken as a hint to maintain both language files in separate entities not as a patch task. The translation table is either an array of two element arrays provided as JSON and thus shall be in a shape like: [ ["repl", "ace"], ["als", "othis"] ] Or the table is given as an object providing more detailed instructions constraining the translation rules like: * contra indicators - when given exempting a line from translation * pro indicators - when given marking a line for translation * flip_flop indicators - providing either stop-start (default) or start-stop state switching The JSON object format is best understood when executing the template command and adapting the resulting JSON object written to standard out. Default for input source is standard in and out per default is sent to standard out.Options: -V, --version Display the afasi version and exit -h, --help Show this message and exit.Commands: template Write a template of a translation table JSON structure to... translate Translate from a language to a 'langauge'. version Display the afasi version and exit
Translate Help
$ afasi translate -hUsage: afasi translate [OPTIONS] [SOURCE] [TARGET] Translate from a language to a 'langauge'.Arguments: [SOURCE] [default: STDIN] [TARGET] [default: STDOUT]Options: -i, --input
Path to input file (default is reading from
standard in) -o, --output
Path to non-existing output file (default is
writing to standard out) -t, --table
Path to translation table file in JSON format. Structure of table data is [["repl", "ace"], ["als", "othis"]] -n, --dryrun Flag to execute without writing the translation but a diff instead (default is False) -h, --help Show this message and exit.
Translate Dryrun
Rock' -> '>Lounge' 2. '>Track' -> '>Rock' * diff of source to target: --- SOURCE +++ TARGET @@ -6,12 +6,12 @@ Some Track
Does not matter.
-
Track
+
Rock
Some Rock
Does not matter.
-
Rock
+
Lounge
# --- ">
$ afasi translate minimal-in.xml --table minimal.json --dryrundryrun requested
# ---* resources used: - input from: "minimal-in.xml" - output to: STDOUT - translation from: "minimal.json"* translations (in order): 1. '>Rock' -> '>Lounge' 2. '>Track' -> '>Rock'* diff of source to target:--- SOURCE+++ TARGET@@ -6,12 +6,12 @@Some Track
Does not matter.
-
Track
+
Rock
Some Rock
Does not matter.
-
Rock
+
Lounge
# ---
Translate
Some Track
Does not matter.
-
Track
+
Rock
Some Rock
Does not matter.
-
Rock
+
Lounge
">
$ afasi translate --input minimal-in.xml --output minimal-out.xml --table minimal.json
$ afasi % diff -u minimal-*.xml--- minimal-in.xml 2021-10-20 20:12:54.000000000 +0200+++ minimal-out.xml 2021-10-20 20:14:45.000000000 +0200@@ -6,12 +6,12 @@Some Track
Does not matter.
-
Track
+
Rock
Some Rock
Does not matter.
-
Rock
+
Lounge
The translation table entries are applied in order per line of input. So, with large translation tables the performance will obviously degrade with a power of two. The latter should be taken as a hint to maintain both language files in separate entities not as a patch task.
The translation table is either an array of two element arrays provided as JSON and thus shall be in a shape like:
[
["repl", "ace"],
["als", "othis"]
]
Or the table is given as an object providing more detailed instructions constraining the translation rules like:
contra indicators - when given exempting a line from translation
pro indicators - when given marking a line for translation
flip_flop indicators - providing either stop-start (default) or start-stop state switching
The JSON object format is best understood when executing the template command and adapting the resulting JSON object written to standard out.
Default for input source is standard in and out per default is sent to standard out.
Usage:
$ afasi [OPTIONS] COMMAND [ARGS]...
Options:
-V, --version: Display the afasi version and exit [default: False]
-h, --help: Show this message and exit.
Commands:
template: Write a template of a translation table JSON...
translate: Translate from a language to a 'langauge'.
version: Display the afasi version and exit
afasi template
Write a template of a translation table JSON structure to standard out and exit
Usage:
$ afasi template [OPTIONS]
Options:
-h, --help: Show this message and exit.
afasi translate
Translate from a language to a 'langauge'.
Usage:
$ afasi translate [OPTIONS] [SOURCE] [TARGET]
Arguments:
[SOURCE]: [default: STDIN]
[TARGET]: [default: STDOUT]
Options:
-i, --input
: Path to input file (default is reading from standard in) [default: ]
-o, --output
: Path to non-existing output file (default is writing to standard out) [default: ]
-t, --table
: Path to translation table file in JSON format. Structure of table data is [["repl", "ace"], ["als", "othis"]] [default: ]
-n, --dryrun: Flag to execute without writing the translation but a diff instead (default is False) [default: False]
Automates much of the process of moving translations from the old Multilingual external module to the newer built-in Multi-Language Management (MLM) page.
A wordlist generator tool, that allows you to supply a set of words, giving you the possibility to craft multiple variations from the given words, creating a unique and ideal wordlist to use regarding a specific target.
SnapMix: Semantically Proportional Mixing for Augmenting Fine-grained Data (AAAI 2021) PyTorch implementation of SnapMix | paper Method Overview Cite
Releases(v2021.10.28)
v2021.10.28(Dec 28, 2021)
afasi
Fuzz a language by mixing up only few words.
v2021.10.28
Happy linter, happy winter
Installation
Preferred way to install is as usual (for testing or in isolation):
$ pipx install afasi
For production use (well, ahem, ...) or within a virtual python env:
$ pip install afasi
Use
Examples
Version
$ afasi version
Fuzz a language by mixing up only few words. version 2021.10.28
General Help
$ afasi
Usage: afasi [OPTIONS] COMMAND [ARGS]...
Fuzz a language by mixing up only few words.
The translation table entries are applied in order per line of input. So,
with large translation tables the performance will obviously degrade with a
power of two. The latter should be taken as a hint to maintain both language
files in separate entities not as a patch task.
The translation table is either an array of two element arrays provided as
JSON and thus shall be in a shape like:
[
["repl", "ace"],
["als", "othis"]
]
Or the table is given as an object providing more detailed instructions
constraining the translation rules like:
* contra indicators - when given exempting a line from translation
* pro indicators - when given marking a line for translation
* flip_flop indicators - providing either stop-start (default) or start-stop state switching
The JSON object format is best understood when executing the template
command and adapting the resulting JSON object written to standard out.
Default for input source is standard in and out per default is sent to
standard out.
Options:
-V, --version Display the afasi version and exit
-h, --help Show this message and exit.
Commands:
template Write a template of a translation table JSON structure to...
translate Translate from a language to a 'langauge'.
version Display the afasi version and exit
Translate Help
$ afasi translate -h
Usage: afasi translate [OPTIONS] [SOURCE] [TARGET]
Translate from a language to a 'langauge'.
Arguments:
[SOURCE] [default: STDIN]
[TARGET] [default: STDOUT]
Options:
-i, --input <sourcepath> Path to input file (default is reading from
standard in)
-o, --output <targetpath> Path to non-existing output file (default is
writing to standard out)
-t, --table <translation table path>
Path to translation table file in JSON
format. Structure of table data is [["repl",
"ace"], ["als", "othis"]]
-n, --dryrun Flag to execute without writing the
translation but a diff instead (default is
False)
-h, --help Show this message and exit.
The translation table entries are applied in order per line of input.
So, with large translation tables the performance will obviously degrade with a power of two.
The latter should be taken as a hint to maintain both language files in separate entities not as a patch task.
The translation table is either
an array or two element arrays provided as JSON and thus shall be in a shape like:
[
["repl", "ace"],
["als", "othis"]
]
or an object allowing for pro, contra replace indications, flip-flop behavior and more (see help for more info).
Default for input source is standard in and out per default is sent to standard out.
The translation table entries are applied in order per line of input.
So, with large translation tables the performance will obviously degrade with a power of two.
The latter should be taken as a hint to maintain both language files in separate entities not as a patch task.
The translation table is an array or two element arrays provided as JSON and thus shall be in a shape like:
[
["repl", "ace"],
["als", "othis"]
]
Default for input source is standard in and out per default is sent to standard out.
The translation table entries are applied in order per line of input.
So, with large translation tables the performance will obviously degrade with a power of two.
The latter should be taken as a hint to maintain both language files in separate entities not as a patch task.
The translation table is an array or two element arrays provided as JSON and thus shall be in a shape like:
[
["repl", "ace"],
["als", "othis"]
]
Default for input source is standard in and out per default is sent to standard out.
Working with teams, changing things and the way we work.
Any personal contribution of this user is MIT licensed.
Opinions expressed on behalf of himself only.