class, copy=False)[source]

Bases: docarray.base.BaseProtoView,

It offers a Pythonic interface to allow users access and manipulate docarray_pb2.NamedScoreMappingProto object without working with Protobuf itself.

It offers an interface to access and update scores as NamedScore as values of a dict with a string key.

To create a NamedScoreMappingProto object, simply:

from import NamedScoreMapping
scores = NamedScoreMapping()
scores['score'] = 50

NamedScoreMapping can be built from docarray_pb2.NamedScoreMappingProto (as a weak reference or a deep copy)

  • scores – The scores to construct from, depending on the copy, it builds a view or a copy from it.

  • copy (bool) – When scores is given as a NamedScoreMappingProto object, build a view (i.e. weak reference) from it or a deep copy from it.

  • kwargs – Other parameters to be set