# TFIDFRetriever

> **Class** in `langchain_community`

📖 [View in docs](https://reference.langchain.com/python/langchain-community/retrievers/tfidf/TFIDFRetriever)

`TF-IDF` retriever.

Largely based on
https://github.com/asvskartheek/Text-Retrieval/blob/master/TF-IDF%20Search%20Engine%20(SKLEARN).ipynb

## Signature

```python
TFIDFRetriever()
```

## Extends

- `BaseRetriever`

## Properties

- `vectorizer`
- `docs`
- `tfidf_array`
- `k`
- `model_config`

## Methods

- [`from_texts()`](https://reference.langchain.com/python/langchain-community/retrievers/tfidf/TFIDFRetriever/from_texts)
- [`from_documents()`](https://reference.langchain.com/python/langchain-community/retrievers/tfidf/TFIDFRetriever/from_documents)
- [`save_local()`](https://reference.langchain.com/python/langchain-community/retrievers/tfidf/TFIDFRetriever/save_local)
- [`load_local()`](https://reference.langchain.com/python/langchain-community/retrievers/tfidf/TFIDFRetriever/load_local)

---

[View source on GitHub](https://github.com/langchain-ai/langchain-community/blob/a6a6079511ac8a5c1293337f88096b8641562e77/libs/community/langchain_community/retrievers/tfidf.py#L13)