langdash.search package#

Submodules#

langdash.search.engine module#

Classes:

Engine()

Base class representing a search engine that can search for texts in a collection of documents.

class langdash.search.engine.Engine[source]#

Bases: object

Base class representing a search engine that can search for texts in a collection of documents.

Methods:

add(texts)

Add one or more documents to the search engine.

search(text[, max_documents])

Search for documents relating to text in the engine.

add(texts: str | List[str])[source]#

Add one or more documents to the search engine.

Arg:
texts (Union[str, List[str]]):

a document or a list of documents to add to the search engine.

search(text: str, max_documents: int = 1) → Generator[Tuple[int, str, float], None, None][source]#

Search for documents relating to text in the engine.

Parameters:
  • text (str) – The text to search for in the documents.

  • max_documents (int) – The maximum number of documents to search through. Default is 1.

Returns:

A generator of tuples containing the index of the document, its content and its relevance score to the search text.

Module contents#