Download rake_find.py from aguyader/Test_Bot: direct link, hf CLI and curl.
- Browser
- Download file 453 Bytes
-
https://huggingface.co/spaces/aguyader/Test_Bot/resolve/main/rake_find.py
- Command line
-
hf download hf://spaces/aguyader/Test_Bot/rake_find.py
-
curl -L -o rake_find.py https://huggingface.co/spaces/aguyader/Test_Bot/resolve/main/rake_find.py
453 Bytes
| from rake_nltk import Rake | |
| import nltk | |
| nltk.download('punkt_tab') | |
| def extract_keywords_rake(question): | |
| r = Rake() | |
| # Extract keywords | |
| r.extract_keywords_from_text(question) | |
| keywords = r.get_ranked_phrases() | |
| return keywords | |
| # Example chatbot question | |
| question = "What is the weather like in New York City today?" | |
| # Extract keywords using Rake | |
| keywords_rake = extract_keywords_rake(question) | |
| print("Keywords:", keywords_rake) | |