@@ -123,6 +123,7 @@ def __init__(
123123 text_weights (Optional[Dict[str, float]): The importance weighting of individual words
124124 within the query text. Defaults to None, as no modifications will be made to the
125125 text_scorer score.
126+
126127 Raises:
127128 ValueError: If the text string is empty, or if the text string becomes empty after
128129 stopwords are removed.
@@ -189,6 +190,7 @@ def _set_stopwords(self, stopwords: Optional[Union[str, Set[str]]] = "english"):
189190 language will be used. if a list, set, or tuple of strings is provided then those
190191 will be used as stopwords. Defaults to "english". if set to "None" then no stopwords
191192 will be removed.
193+
192194 Raises:
193195 TypeError: If the stopwords are not a set, list, or tuple of strings.
194196 """
@@ -218,6 +220,7 @@ def _tokenize_and_escape_query(self, user_query: str) -> str:
218220
219221 Returns:
220222 str: The tokenized and escaped query string.
223+
221224 Raises:
222225 ValueError: If the text string becomes empty after stopwords are removed.
223226 """
@@ -229,9 +232,6 @@ def _tokenize_and_escape_query(self, user_query: str) -> str:
229232 )
230233 for token in user_query .split ()
231234 ]
232- ##tokenized = " | ".join(
233- ## [token for token in tokens if token and token not in self._stopwords]
234- ##)
235235
236236 token_list = [
237237 token for token in tokens if token and token not in self ._stopwords
@@ -273,7 +273,7 @@ def set_text_weights(self, weights: Dict[str, float]):
273273 text_weights: Dictionary of word:weight mappings
274274 """
275275 self ._text_weights = self ._parse_text_weights (weights )
276- self ._built_query_string = None
276+ self ._query = self . _build_query_string ()
277277
278278 @property
279279 def text_weights (self ) -> Dict [str , float ]:
0 commit comments