txtaug: text augmentation command line tool in Python

txtaug

txtaug is a command line tool written in Python3 for text augmentation based on Baidu translation API.

Install

1
pip3 install txtaug

Usage

1
2
3
4
5
6
7
8
9
10
11
12
13
14
txtaug [-h] [-l LANGUAGE] [-t TIMES] [-s] [-a APPID] [-k KEY] [-T TEXT]

optional arguments:
-h, --help show this help message and exit
-l LANGUAGE, --language LANGUAGE
source language code of the input text. reference
http://api.fanyi.baidu.com/api/trans/product/apidoc
-t TIMES, --times TIMES
times to augment
-s, --self_including whether to show the input text on output
-a APPID, --appid APPID
your baidu api app_id
-k KEY, --key KEY your baidu api key
-T TEXT, --text TEXT text to be augmented

Sample

Below is a sample in which we 1 times augmented the Chinese sentence “我爱你” and include the sentence itself in the output.

1
txtaug -l zh -t 1 -s -a your_app_id -k your_key -T "我爱你"

Output

1
2
我爱你
本人喜好你