@ -15,10 +15,9 @@ The Rerank operator is used to reorder the list of relevant documents for a quer
```Python
```Python
from towhee import ops
from towhee import ops
op = ops.rerank()
op = ops.rerank(threshold=0)
res = op('What is Towhee?',
res = op('What is Towhee?',
['Towhee is Towhee is a cutting-edge framework to deal with unstructure data.', 'I do not know about towhee', 'Towhee has many powerful operators.', 'The weather is good' ],
0)
['Towhee is Towhee is a cutting-edge framework to deal with unstructure data.', 'I do not know about towhee', 'Towhee has many powerful operators.', 'The weather is good' ])
.flat_map(('doc', 'score'), ('doc', 'score'), lambda x, y: [(i, j) for i, j in zip(x, y)])
.flat_map(('doc', 'score'), ('doc', 'score'), lambda x, y: [(i, j) for i, j in zip(x, y)])
.output('query', 'doc', 'score')
.output('query', 'doc', 'score')
)
)
DataCollection(p('What is Towhee?',
DataCollection(p('What is Towhee?',
['Towhee is Towhee is a cutting-edge framework to deal with unstructure data.', 'I do not know about towhee', 'Towhee has many powerful operators.', 'The weather is good' ],
0)
['Towhee is Towhee is a cutting-edge framework to deal with unstructure data.', 'I do not know about towhee', 'Towhee has many powerful operators.', 'The weather is good' ])
).show()
).show()
```
```
@ -56,6 +54,10 @@ Create the operator via the following factory method
The model name of CrossEncoder, you can set it according to the [Model List](https://www.sbert.net/docs/pretrained-models/ce-msmarco.html#models-performance).
The model name of CrossEncoder, you can set it according to the [Model List](https://www.sbert.net/docs/pretrained-models/ce-msmarco.html#models-performance).
***threshold***: float
The threshold for filtering with score, defaults to none, i.e., no filtering.
<br/>
<br/>
@ -74,10 +76,6 @@ This operator is used to sort the documents of the query content and return the
A list of sentences to check the correlation with the query content.
A list of sentences to check the correlation with the query content.
***threshold***: float
The threshold for filtering with score, defaults to none, i.e., no filtering.