Spaces:
Runtime error
Runtime error
| class InputHandler: | |
| def process_query(self, query): | |
| """ | |
| Process and validate user input | |
| """ | |
| # Clean and normalize query | |
| cleaned_query = query.strip() | |
| # Add context if needed | |
| if len(cleaned_query) < 5: | |
| raise ValueError("Query too short. Please provide more details.") | |
| return cleaned_query | |
| def extract_keywords(self, query): | |
| """ | |
| Extract important keywords from query | |
| """ | |
| # Simple keyword extraction (could be enhanced with NLP) | |
| stop_words = {'the', 'is', 'at', 'which', 'on', 'in', 'for', 'of', 'with', 'by'} | |
| words = query.lower().split() | |
| keywords = [word for word in words if word not in stop_words] | |
| return keywords |