Exemplo n.º 1
0
 def raw_to_proto(self, raw):
     """doc"""
     ids = [
         s if isinstance(s, int) else self.vocab.get(s, self.unk_id)
         for s in self.tokenizer(raw)
     ]
     fe = feature_pb2.Feature(int64_list=feature_pb2.Int64List(value=ids))
     return fe
Exemplo n.º 2
0
 def raw_to_proto(self, raw):
     """doc"""
     if self.vocab is None:
         ids = [int(raw)]
     else:
         ids = [self.vocab[raw]]
     fe = feature_pb2.Feature(int64_list=feature_pb2.Int64List(value=ids))
     return fe
Exemplo n.º 3
0
 def raw_to_proto(self, raw):
     """doc"""
     return feature_pb2.Feature()
Exemplo n.º 4
0
 def raw_to_proto(self, raw):
     """doc"""
     ids = [int(s) for s in raw.split(b' ')]
     fe = feature_pb2.Feature(int64_list=feature_pb2.Int64List(value=ids))
     return fe
Exemplo n.º 5
0
 def raw_to_proto(self, raw):
     """doc"""
     fe = feature_pb2.Feature(bytes_list=feature_pb2.BytesList(value=[raw]))
     return fe