textaugment | TextAugment : Text Augmentation Library | Natural Language Processing library
kandi X-RAY | textaugment Summary
kandi X-RAY | textaugment Summary
TextAugment is a Python 3 library for augmenting text for natural language processing applications. TextAugment stands on the giant shoulders of NLTK, Gensim, and TextBlob and plays nicely with them.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Perform the flow computation
- Mixup data
- Validate input parameters
- Augment the word2vec model
- Gaussian distribution
- Replace synonym with n words
- Replace words with their respective synonyms
- Gaussian function
- Validate keyword arguments
- Return a list of synonyms for a word
- Delete a random word from a sentence
- Swap a sentence
- Swap two words
- Insert n words into the sentence
- Adds a word to the list
- Augment the given string with the given language
- Find the version from a file
- Read content of file
textaugment Key Features
textaugment Examples and Code Snippets
Community Discussions
Trending Discussions on textaugment
QUESTION
I'm doing a sentiment analysis on the IMDB dataset in tensorflow and I'm trying to augment the training dataset by using the textaugment library which they said is 'plug and play' into tensorflow. So it should be rather simple, but I'm new to tf so I'm not sure how to go about doing that. Here is what I have and what I am trying, based on reading the tutorials on the site.
I tried to do a map to augment the training data but I got an error. You can scroll down to the last code block to see the error.
...ANSWER
Answered 2021-Apr-24 at 18:21I am also trying to do the same. The error occurs because the textaugment function t.random_swap()
is supposed to work on Python string objects.
In your code, the function is taking in a Tensor with dtype=string. As of now, tensor objects do not have the same methods as Python strings. Hence, the error code.
Nb. tensorflow_text has some additional APIs to work with such tensors of string types. Albeit, it is limited at the moment to tokenization, checking upper or lower case etc. A long winded workaround is to use the py_function
wrapper but this reduces performance. Cheers and hope this helps. I opted not to use textaugment in the end in my use case.
Nbb. tf.strings APIs have a bit more functionalities, such as regex replace etc but it is not complicated enough for your use case of augmentation. Would be helpful to see what others come up with, or if there are future updates to either TF or textaugment.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install textaugment
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page