Giter Club home page Giter Club logo

textdataaug's Introduction

TextDataAug

TextDataAug is pipeline has implemented for Boosting Performance on Text Classification tasks by using "Easy Data Augmentation" , "Back-Translation" techniques and to support 22 languages.Given a sentence in the training set, we perform the following operations:

  • Synonym Replacement (SR): Randomly choose n words from the sentence that are not stop words. Replace each of these words with one of its synonyms chosen at random.
  • Random Insertion (RI): Find a random synonym of a random word in the sentence that is not a stop word. Insert that synonym into a random position in the sentence. Do this n times.
  • Random Swap (RS): Randomly choose two words in the sentence and swap their positions. Do this n times.
  • Random Deletion (RD): For each word in the sentence, randomly remove it with probability p.
  • Back-Translation

The pipeline has been implemented based on EDA: Easy Data Augmentation Techniques for Boosting Performance on Text Classification Tasks and Low Resource Text Classification with ULMFit and Backtranslation.

TextDataAug supports 22 languages:

Arabic , Catalan , Danish , English , Basque , Persian , Finnish , French , Galician , Hebrew , Indonesian , Italian , Japanese , Norwegian Nynorsk , Norwegian Bokmål , Polish , Polish , Spanish , Thai , Mal

Requirements

Python 3

The following software packages are dependencies.

$ pip install numpy nltk gensim textblob googletrans 

The following code downloads stopwords and wordnet data

nltk.download('stopwords')
nltk.download('omw')
nltk.download('wordnets')

Usage

tda=DataAugmentation('english')
text_out=tda.AugPipeLine("Great movie. This is the type of movie you just want to watch time and time again. A real classic.)
tda=DataAugmentation('english')
print(tda.AugPipeLine("Great movie. This is the type of movie you just want to watch time and time again. A real classic.",num=2,probability=0.2,bktr=True,translate_to='es'))

References

textdataaug's People

Contributors

oraby8 avatar

Stargazers

Mohammad Vahidi avatar Fernando avatar  avatar Saied Alshahrani avatar Mosleh Mahamud avatar  avatar Angelina avatar

Watchers

 avatar

textdataaug's Issues

English words being introduced during Arabic Data Augmentation

Hello, I am testing this data augmentation as in the following:

from TextDataAug.TDA import DataAugmentation

tda=DataAugmentation('arabic')
print(tda.AugPipeLine("أتمنى وجود منافسين أكثر تنوعاً في هذا المجال",num=5,probability=0.4,bktr=True,translate_to='en'))

output is the following

['أتمنى وجود منافسين أكثر تنوعاً في هذا المجال', 'commit وجود منافسين أكثر تنوعاً في هذا المجال', 'confide أتمنى وجود منافسين أكثر commit تنوعاً في هذا المجال', 'أتمنى وجود منافسين المجال تنوعاً في هذا أكثر', 'أتمنى وجود أكثر تنوعاً هذا المجال', 'أتمنى وجود منافسين أكثر تنوعاً في هذا المجال']

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.