This is a random word generator module
Project description
Random Word Generator
How to install this library?
pip3 install Random-Word-Generator
OR
pip install Random-Word-Generator
Which other python packages are needed to be installed?
- No need of any external packages
- Only Python version >= 3 is required
What this library does?
It helps us to generate random words i.e random noise in text data which is helpful in many text augmentation based tasks, NER, etc.
Which methods are available currently in this library?
Method | Args | Description |
---|---|---|
.generate() | None | This will return a randomly generated word |
.getList(num_of_words) | num_of_words | This will return list of random words |
Setting to look out before generating random words
Basic
from RandomWordGenerator import RandomWord
# Creating a random word object
rw = RandomWord(max_word_size,
constant_word_size=True,
include_digits=False,
special_chars=r"@_!#$%^&*()<>?/\|}{~:",
include_special_chars=False)
Args | Data Type | Default | Description |
---|---|---|---|
max_word_size | int | 10 | Represents maximum length of randomly generated word |
constant_word_size | bool | True | Represents word length of randomly generated word |
include_digits | bool | False | Represents whether or not to include digits in generated words |
special_chars | regex/string | r"@_!#$%^&*()<>?/\\ |}{~:" |
Represents a regex string of all specials character you want to include in generated words |
include_special_chars | bool | False | Represents inclusion of special characters in generated words |
How to get started with this library?
-
Simple random word generation with constant word size
from RandomWordGenerator import RandomWord rw = RandomWord(max_word_size=5) print(rw.generate())
Output will be some random word like > hdsjq
-
Simple random word generation with variable word size
from RandomWordGenerator import RandomWord rw = RandomWord(max_word_size=5, constant_word_size=False) print(rw.generate())
Output will be some random word like > gw
-
Random word generation with constant word size and including special character included
from RandomWordGenerator import RandomWord rw = RandomWord(max_word_size=5, constant_word_size=True, special_chars=r"@#$%.*", include_special_chars=True) print(rw.generate())
Output will be some random word like > gsd$
-
If we want randomly generated words in list we just have to input the argument with number of words we want
from RandomWordGenerator import RandomWord rw = RandomWord(max_word_size=5, constant_word_size=False) print(rw.getList(num_of_random_words=3)
Output will be some random word like > ['adjse', 'qytqw', ' klsdf', 'ywete', 'klljs']
Application
- In cases where we need to add random noise in text
- Name Entity Relation extraction based tasks
- Text Data Augmentation based tasks
Author
I will be happy to connect with you guys!!
Any suggestions are most welcome.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for Random-Word-Generator-1.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | f0d46f11db49c4e8a9af856964b91330fa6b7400d12848964c6929e7d08ce797 |
|
MD5 | 20078536cd086143e826de529755dda2 |
|
BLAKE2b-256 | 8a5fc945de8aadd65b8cfd916ea37e3649452c96779f8f13d0d55e84a6e15a47 |
Close
Hashes for Random_Word_Generator-1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8ffe4a149648264929656497ebfeb1e21be8eae035f2206c1814a5806c2e5800 |
|
MD5 | cf4a855628cadaee65d3a0e476125310 |
|
BLAKE2b-256 | 07ec5d511a371d09698064206f9738899efe2e9dba7e5533c4b48c82d45637fe |