

def pretty_format(self, indent=3):
    try:
        accum = ('%s:[' % self.label)
    except NameError:
        accum = '['
    try:
        accum += ("pred '%s'" % self.pred[0])
    except NameError:
        pass
    for feature in sorted(self):
        for item in self[feature]:
            if isinstance(item, FStructure):
                next_indent = (((indent + len(feature)) + 3) + len(self.label))
                accum += ('\n%s%s %s' % ((' ' * indent), feature, indent.pretty_format(next_indent)))
            elif isinstance(item, tuple):
                accum += ("\n%s%s '%s'" % ((' ' * indent), feature, item[0]))
            elif isinstance(item, list):
                accum += ('\n%s%s {%s}' % ((' ' * indent), feature, ('\n%s' % (' ' * ((indent + len(feature)) + 2))).join(item)))
            else:
                raise Exception(('feature %s is not an FStruct, a list, or a tuple' % feature))
    return (accum + ']')

dataset/ETHPy150Open nltk/nltk/nltk/sem/lfg.py FStructure.pretty_format/VarMisuse@133/170 `item`->`indent`