Logic package#
Subpackages#
Logic.utils module#
- correct_text(text: str, all_documents: List[str]) str #
Correct the give query text, if it is misspelled using Jacard similarity
Paramters#
- text: str
The query text
- all_documentslist of str
The input documents.
Returns str
The corrected form of the given text
- search(query: str, max_result_count: int, method: str = 'ltn-lnn', weights: list = [0.3, 0.3, 0.4], should_print=False, preferred_genre: str = None, smoothing_method=None, alpha=0.5, lamda=0.5)#
Finds relevant documents to query
- Parameters:
query – The query text
max_result_count (Return top 'max_result_count' docs which have the highest scores.) – notice that if max_result_count = -1, then you have to return all docs
method ('ltn.lnn' or 'ltc.lnc' or 'OkapiBM25')
weights –
- The list, containing importance weights in the search result for each of these items:
Indexes.STARS: weights[0], Indexes.GENRES: weights[1], Indexes.SUMMARIES: weights[2],
preferred_genre – A list containing preference rates for each genre. If None, the preference rates are equal. (You can leave it None for now)
- Returns:
list
Retrieved documents with snippet