code: def to_dict(self):
          
          d = {
              'id': self.id,
              'start': self.start,
              'end': self.end,
              'form': self.form
          }
          if self.lnk is not None:
              cfrom, cto = self.lnk.data
              d['from'] = cfrom
              d['to'] = cto
          # d['paths'] = self.paths
          if self.surface is not None:
              d['surface'] = self.surface
          # d['ipos'] = self.ipos
          # d['lrules'] = self.lrules
          if self.pos:
              d['tags'] = [ps[0] for ps in self.pos]
              d['probabilities'] = [ps[1] for ps in self.pos]
          return d
docs: Encode the token as a dictionary suitable for JSON serialization.