Getting Started

Getting Started

Getting started with LESP is pretty easy and straightforward. Just follow the steps below to quickly get yourself in the flow of things. Won't take long, I promise.

Before you install

Prerequisites

And that's about it. Since this library doesn't have any external dependencies, simply a Python 3.6 or higher on your machine is already enough. Git here is only used to clone the repository, but you can also download the source code as a zip file from GitHub, see our releases page for more information.

Installing with Git

If you already know how to git clone something, skip this step. If not, here's how to do it:

  1. First of all, open up a terminal (or command prompt) and navigate (using cd) to the directory where you want to install LESP.

cd /path/to/where/you/want/to/install/lesp
  1. Then, clone the repository using git. If you don't have git installed, see the Prerequisites section above for a link.

git clone https://github.com/LyubomirT/lesp.git
  1. Now, you should have a directory called lesp in the directory you navigated to in step 1. Navigate to it.

cd lesp

Now you're good to go! LESP is successfully installed on your machine.

Installing with PyPi

The package is now uploaded to PyPi, and you can easily install it simply by running:

pip install lesp

After that, LESP will be successfully installed on your machine!

Usage

Basic Usage

LESP uses a single class called Proofreader to do all the work. To use it, simply import it from the lesp.autocorrect module and create an instance of it.

from lesp.autocorrect import Proofreader

proofreader = Proofreader()

The instance you made is now ready to be used. It's basically the key to all the library's features. It offers quite a bit of functions. Most important ones are is_correct and get_similar though. Here's how you can integrate these into your code:

from lesp.autocorrect import Proofreader

proofreader = Proofreader()

if not proofreader.is_correct("apgle"):
    print("Did you mean: " + proofreader.get_similar("apgle")[0])

Simple as that! This code above will check if the word apgle is correct. If it's not, it will print out the most similar word to it. In this case, since apgle is not a valid word, it will print out apple.

If you need more real-life examples, check out the Examples section of the docs. There are some samples you might want to check out to better understand how LESP can be used.

Ready to move on?

If you feel like you're ready to get into developing with LESP deeper, you can go ahead and take a look at Words! There's a lot of useful information there, so make sure to take a look at it. Hopefully you'll find what you're looking for.

Issues

If you encounter any issues or problems with LESP, or if you ever feel lost, don't hesitate to open an issue on the Issues page. We'll try to get to you as soon as possible!

Last updated