Download src/retrieval/preprocess.py from Ilaa-1505/Explainable-RAG-System: direct link, hf CLI and curl.
- Browser
- Download file 230 Bytes
-
https://huggingface.co/spaces/Ilaa-1505/Explainable-RAG-System/resolve/main/src/retrieval/preprocess.py
- Command line
-
hf download hf://spaces/Ilaa-1505/Explainable-RAG-System/src/retrieval/preprocess.py
-
curl -L -o preprocess.py https://huggingface.co/spaces/Ilaa-1505/Explainable-RAG-System/resolve/main/src/retrieval/preprocess.py
230 Bytes
| from nltk.stem import WordNetLemmatizer | |
| from nltk.tokenize import word_tokenize | |
| lemmatizer = WordNetLemmatizer() | |
| def preprocess(text): | |
| tokens = word_tokenize(text.lower()) | |
| return [lemmatizer.lemmatize(t) for t in tokens] |