'A nested tree of sentence words, chunks and prepositions.
The input is a tagged string from parse().
The order in which token tags appear can be specified.'

def __init__(self, string='', token=[WORD, POS, CHUNK, PNP, REL, ANCHOR, LEMMA], language='en'):

    if _is_tokenstring(string):
        (token, language) = (string.tags, getattr(string, 'language', language))
    if (not isinstance(string, unicode)):
        for encoding in (('utf-8',), ('windows-1252',), ('utf-8', 'ignore')):
            try:
                string = string.decode(*encoding)
            except:
                pass
    self.parent = None
    self.text = None
    self.language = language
    self.id = _uid()
    self.token = list(token)
    self.words = []
    self.chunks = []
    self.pnp = []
    self._anchors = {}
    self._relation = None
    self._attachment = None
    self._previous = None
    self.relations = {'SBJ': {}, 'OBJ': {}, 'VP': {}}
    for chars in string.split('    '):
        if chars:
            self.append(*self.parse_token(chars, token))
