예제 #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
예제 #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
예제 #3
0
 def raw_to_proto(self, raw):
     """doc"""
     return feature_pb2.Feature()
예제 #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
예제 #5
0
 def raw_to_proto(self, raw):
     """doc"""
     fe = feature_pb2.Feature(bytes_list=feature_pb2.BytesList(value=[raw]))
     return fe