> For the complete documentation index, see [llms.txt](https://lesp.gitbook.io/lesp/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://lesp.gitbook.io/lesp/words/find-similarities.md).

# Find similarities

The LESP library provides a method called `get_similar()` that can be used to find similar words to a specified word. The method takes three parameters:

* `word`: The word to find similar words for.
* `similarity_rate`: The minimum similarity score that a word must have to be considered similar. The similarity rate is a float between 0 and 1, where 0 means no similarity and 1 means perfect similarity.
* `upto`: The maximum number of similar words to return.
* `use_cache`: The switch for using cache before running the scan algorithm.
* `set_cache`: The switch for adding the correction to cache after finding similarities.

The method returns a list of similar words, or `None` if no similar words were found.

#### **Example Usage**

```python
from lesp import Proofreader

proofreader = Proofreader()

# Find words that are 0.8 or more similar to "hello"
similar_words = proofreader.get_similar("hello", 0.8)
print(similar_words)
```

This code will print the following output:

```python
['hallo', 'hello']
```

#### **Using the Cache**

The LESP library can also use a cache to improve performance. The cache is a file that stores the results of previous calls to the `get_similar()` method. This can save time, especially if you are calling the method frequently.

To use the cache, you need to set the `use_cache` parameter to `True` when calling the `get_similar()` method. You can also set the `set_cache` parameter to `True` to save the results of the current call to the cache.

#### **Example Usage**

```python
from lesp import Proofreader

proofreader = Proofreader()

# Find words that are 0.8 or more similar to "hello"
similar_words = proofreader.get_similar("hello", 0.8, use_cache=True, set_cache=True)
print(similar_words)
```

This code will print the following output:

```python
['hallo', 'hello']
```

#### **Clearing the Cache**

The cache can be cleared using the `clear_cache()` method. This can be useful if you want to ensure that the results of the `get_similar()` method are up-to-date.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://lesp.gitbook.io/lesp/words/find-similarities.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
