Class to performs text search.
tflite_support
.
task
.
text
.
TextSearcher
(
options
:
tflite_support
.
task
.
text
.
TextSearcherOptions
,
cpp_searcher
:
_CppTextSearcher
)
->
None
It works by performing embedding extraction on text, followed by nearest-neighbor search in an index of embeddings through ScaNN.
Methods
create_from_file
@classmethodcreate_from_file ( model_file_path : str , index_file_path : Optional [ str ] = None ) -> 'TextSearcher'
Creates the TextSearcher
object from a TensorFlow Lite model.
model_file_path
index_file_path
TextSearcher
object that's created from options
.
ValueError
TextSearcher
object from the provided
file such as invalid file.RuntimeError
create_from_options
@classmethodcreate_from_options ( options :tflite_support . task . text . TextSearcherOptions) -> 'TextSearcher'
Creates the TextSearcher
object from text searcher options.
options
TextSearcher
object that's created from options
.
ValueError
TextSearcher
object from TextSearcherOptions
such as missing the model.RuntimeError
get_user_info
get_user_info
()
->
str
Gets the user info stored in the index file.
search
search
(
text
:
str
)
->
tflite_support
.
task
.
processor
.
SearchResult
Search for text with similar semantic meaning.
This method performs actual feature extraction on the provided text input, followed by nearest-neighbor search in the index.
ValueError
RuntimeError


