Find some simple instructions below
First, obtain at least Python 3.6 and virtualenv if you do not already have them. Using a virtual environment is strongly recommended, since it will help you to avoid clutter in your system-wide libraries. Once the requirements are met, you can use pip:
pip install trrex
Here are some quick examples of what you can do with trrex.
To begin, import re and trrex:
In : import re In : import trrex as tx
Search for any keyword
You can search for keywords by using re.search:
In : keywords = tx.make(["baby", "bad", "bat"]) In : match = re.search(keywords, "I saw a bat") In : match Out: <_sre.SRE_Match object; span=(8, 11), match='bat'>
In this case we find bat the only keyword appearing in the text.
Replace a keyword
You can replace a keyword by using re.sub:
In : keywords = tx.make(["baby", "bad", "bat"]) In : replaced = re.sub(keywords, "bowl", "The bat is round") In : replaced Out: 'The bowl is round'