def __str__(self):
        """
        returns the string representation of a `LinguisticDocument`, i.e
        node, edge and layer counts, as well as counts of subtypes and the
        primary text of the document itself.
        """
        ret_str = ""
        for element_type in ('nodes', 'edges', 'layers'):
            elements = getattr(self, element_type)
            subtype_counts = defaultdict(int)
            ret_str += "{0} {1}:\n".format(len(elements), element_type)
            for element in elements:
                subtype_counts[type(element).__name__] += 1
            for subtype in subtype_counts:
                ret_str += "\t{0}: {1}\n".format(subtype,
                                                 subtype_counts[subtype])
            ret_str += "\n"
        ret_str += "primary text:\n{0}".format(self.text.encode('utf-8'))
        return ret_str
def __str__ ( self ) : ret_str = "" for element_type in ( 'nodes' , 'edges' , 'layers' ) : elements = getattr ( self , element_type ) subtype_counts = defaultdict ( int ) ret_str += "{0} {1}:\n" . format ( len ( elements ) , element_type ) for element in elements : subtype_counts [ type ( element ) . __name__ ] += 1 for subtype in subtype_counts : ret_str += "\t{0}: {1}\n" . format ( subtype , subtype_counts [ subtype ] ) ret_str += "\n" ret_str += "primary text:\n{0}" . format ( self . text . encode ( 'utf-8' ) ) return ret_str
returns the string representation of a `LinguisticDocument`, i.e
        node, edge and layer counts, as well as counts of subtypes and the
        primary text of the document itself.