Built with Python 3.9.
Text file: The Project Gutenberg EBook of The Adventures of Sherlock Holmes by Sir Arthur Conan Doyle. (largeText.txt
)
Number of characters: 6488666
Instructions to run:
Method #1: The easy way!!!
Inorder to do this, just follow these steps.
1. Clone the repository
!git clone https://github.com/abhishek-choudharys/FUS-E.git
Or you can download
it directly as a .zip
file by clicking here. Then extract the contents and move to step 2.
2. Run the .exe file
- If you want to query on largeText.txt, just run
test_keyword.exe
. Enter the query and see the results. - (Optional) If you want to select your own input file, just run
test_customFile.exe
. Enter the address of the .txt file and then the search query.
To see example queries, scroll down to see examples.
(Be sure to run the .exe files while in the repo, otherwise there may be path conflicts.)
Easy Peasy Fuzzy Search. Show some love and drop a ⭐.
Method #2: The i-want-to-see-the-code way.
Note: To avoid any unwanted hassles, you can easily run the code on Google Colab.
1. Let’s install the necessary packages
Inorder to do this, please run the commands on screen.
pip install fuzzysearch
pip install fuzzywuzzy
pip install textdistance
OR
If you’re using anaconda, please follow:
conda install -c conda-forge fuzzysearch
conda install -c conda-forge fuzzywuzzy
conda install -c conda-forge textdistance
OR
If you want to copy my exact anaconda environment, run: (This is not really necessary) (Also, do this after downloading the repository)
conda env create -f src/environment.yml
Note: Only the fuzzysearch library is actually required to perform the fuzzy search operation. Rest of the libraries have been used only for further testing.
2. Now let’s run the code
Download the code using this command and set current location as the directory.
!git clone https://github.com/abhishek-choudharys/FUS-E.git
cd FUS-E
If you want to see the results on pre-defined input file by entering the keyword, just run test_keyword.py
.
You can enter your search query here, based on largeText.txt
.
run src/test_keyword.py
If you want to test it on your input file, run test_customFile.py
.
Enter the address of the text file when prompted, and then enter your query.
run src/test_customFile.py
Results:
A couple of snapshots demonstrating the search.