Expand your wordlist

In LESP, you don't always have to stick with a single wordlist. This can be easily changed with Wordlist Expansion. With that feature, you can dynamically manipulate your wordlists so that you can easily get modified versions. This is useful when you want to use a different wordlist for a specific purpose, but don't want to create a new file yourself.

Add new words to your wordlist

To expand your wordlist, you can use the extend_wordlist method. This method takes in a string, list, or tuple of words and adds them to the wordlist.

from lesp import Proofreader

proofreader = Proofreader()

# Add a single word
proofreader.extend_wordlist("hello")

# Add multiple words
proofreader.extend_wordlist(["hello", "world"])

Remove words from your wordlist

An opposite method to extend_wordlist is remove_from_wordlist. This method takes in a string, list, or tuple of words and removes them from the wordlist.

from lesp import Proofreader

proofreader = Proofreader()

# Remove a single word
proofreader.remove_from_wordlist("hello")

# Remove multiple words
proofreader.remove_from_wordlist(["hello", "world"])

Wordlist Stacking

Simple enough, right? Now, let's say you have a bunch of wordlists and you want to get a single, larger one. You can use the stack method to do this. This method takes in two file paths: the source file and the destination file. The source file is the file that will be added to the destination file, which is the file that will be modified.

from lesp import Proofreader

proofreader = Proofreader()

# Stack the contents of wordlist1.txt into wordlist2.txt
proofreader.stack("wordlist1.txt", "wordlist2.txt")

Merge-Delete

The merge_delete method is similar to the stack method, but it removes words that are in the source file from the destination file. Here you can pass in two file paths: the source file and the destination file. The source file will provide the words to be removed from the destination file.

from lesp import Proofreader

proofreader = Proofreader()

# Remove the contents of wordlist1.txt from wordlist2.txt
proofreader.merge_delete("wordlist1.txt", "wordlist2.txt")

Last updated