Search Engine Questions
unknown
python
a year ago
780 B
13
Indexable
class SearchEngine: def __init__(self, documents: List[List[str]]): self.documents = self._parse_documents(documents=documents) def search(self, query: str) -> List[Document]: """ Implement a function to search for a query in the document text :returns Sublist of the original list of documents matching the query """ # TODO Implement search here pass documents = [ ['Why I love Football', 'Football is my life and ...'], ['My sporting interests', 'Tennis, football and rugby are sports I love...'], ['Football, football, football', 'This is a guide to the best things about...'] ] se = SearchEngine(documents=documents) if __name__ == '__main__': query = "football" se.search(query=query)
Editor is loading...
Leave a Comment