code: def from_string(cls, s):
          
          def _qstrip(s):
              return s[1:-1]  # remove assumed quote characters
          tokens = []
          for match in _yy_re.finditer(s):
              d = match.groupdict()
              lnk, pos = None, []
              if d['lnkfrom'] is not None:
                  lnk = Lnk.charspan(d['lnkfrom'], d['lnkto'])
              if d['pos'] is not None:
                  ps = d['pos'].strip().split()
                  pos = list(zip(map(_qstrip, ps[::2]), map(float, ps[1::2])))
              tokens.append(
                  YyToken(
                      int(d['id']),
                      int(d['start']),
                      int(d['end']),
                      lnk,
                      list(map(int, d['paths'].strip().split())),
                      _qstrip(d['form']),
                      None if d['surface'] is None else _qstrip(d['surface']),
                      int(d['ipos']),
                      list(map(_qstrip, d['lrules'].strip().split())),
                      pos
                  )
              )
          return cls(tokens)
docs: Decode from the YY token lattice format.