jina.types.score¶
-
class
jina.types.score.
NamedScore
(score=None, copy=False, **kwargs)[source]¶ Bases:
object
NamedScore
is one of the primitive data type in Jina.It offers a Pythonic interface to allow users access and manipulate
jina.jina_pb2.NamedScoreProto
object without working with Protobuf itself.To create a
NamedScore
object, simply:from jina.types.score import NamedScore score = NamedScore() score.value = 10.0
NamedScore
can be built fromjina_pb2.NamedScoreProto
(as a weak reference or a deep copy) or from a set of attributes fromjina_pb2.NamedScoreProto
passed to the constructor.from jina.types.score import NamedScore from jina_pb2 import NamedScoreProto score = NamedScore(value=10.0, op_name='ranker', description='score computed by ranker') score_proto = NamedScoreProto() score_proto.value = 10.0 score = NamedScore(score_proto)
- Parameters
score (
Optional
[NamedScoreProto
]) – the score to construct from, depending on thecopy
, it builds a view or a copy from it.copy (
bool
) – whenscore
is given as aNamedScoreProto
object, build a view (i.e. weak reference) from it or a deep copy from it.kwargs – other parameters to be set