コード例 #1
0
 def __str__(self):
     output = 'Concept:'
     output += '\n'
     output += utils.indent('Label: {}'.format(self.label))
     output += '\n'
     output += utils.indent('ID: {}'.format(self.id_))
     output += '\n'
     output += utils.indent('Freebase ID: {}'.format(self.freebase_id))
     output += '\n'
     return output
コード例 #2
0
 def __str__(self):
     """Pretty prints important details about the Core Response."""
     output = 'Core Response'
     if self.error:
         output += ' - {} error:'.format(self.error_code)
         output += '\n'
         output += utils.indent(
             utils.shorten('{}'.format(self.error_message)))
     else:
         output += ' - {} sentence{}:'.format(
             len(self.data), '' if len(self.data) == 1 else 's')
         output += '\n'
         for d in self.data:
             output += utils.indent('{}'.format(d))
             output += '\n'
     return output
コード例 #3
0
 def __str__(self):
     output = 'Sentence:'
     output += '\n'
     output += utils.indent(
         utils.fill('Text: {}'.format(self.sentence)))
     output += '\n\n'
     output += utils.indent(
         utils.shorten('Tokens: {}'.format(str(self.tokens))))
     output += '\n\n'
     output += utils.indent(
         utils.shorten('Dependencies: {}'.format(str(self.dependencies))))
     if self.graph is not None:
         output += '\n\n'
         output += utils.indent('Graph: {} relation{}'.format(
             len(self.graph), '' if len(self.graph) == 1 else 's'))
     return output
コード例 #4
0
 def __str__(self):
     output = 'Graph'
     output += ' - {} relation{}:'.format(
         len(self), '' if len(self) == 1 else 's')
     output += '\n'
     for x in self:
         output += utils.indent('{}'.format(x))
         output += '\n'
     return output
コード例 #5
0
 def __str__(self):
     output = 'SentenceGroup'
     output += ' - {} alternative{}:'.format(
         len(self.alternatives), '' if len(self.alternatives) == 1 else 's')
     output += '\n'
     for a in self.alternatives:
         output += utils.indent('{}'.format(a))
         output += '\n'
     return output
コード例 #6
0
ファイル: endpoint.py プロジェクト: gridl/plasticity-python
 def __str__(self):
     output = 'Response'
     if self.error:
         output += ' - {} error:'.format(self.error_code)
         output += '\n'
         output += utils.indent(
             utils.shorten('{}'.format(self.error_message)))
     else:
         output = '<Response {}>'.format(self.response)
     return output
コード例 #7
0
 def __str__(self):
     output = 'Relation:'
     output += '\n'
     if self.qualifiers.size() > 0:
         output += utils.indent(utils.shorten(
             'Qualifiers: {}'.format(str(self.qualifiers))))
         output += '\n'
     if self.question:
         output += utils.indent('Question: {}'.format(self.question))
         output += '\n'
         output += utils.indent(
             'Question Auxiliary: {}'.format(
                 self.question_auxiliary))
         output += '\n'
     if self.verb_modifiers_subject_prefix.size() > 0:
         output += utils.indent(utils.shorten('Verb Modifiers Subject Prefix: {}'.format(  # noqa
             str(self.verb_modifiers_subject_prefix))))
         output += '\n'
     output += utils.indent('Subject: {}'.format(repr(self.subject)))
     output += '\n'
     output += utils.indent('Predicate: {}'.format(repr(self.predicate)))
     output += '\n'
     output += utils.indent('Object: {}'.format(repr(self.object)))
     output += '\n'
     if self.verb_modifiers_object_suffix.size() > 0:
         output += utils.indent(utils.shorten('Verb Modifiers Object Suffix: {}'.format(  # noqa
             str(self.verb_modifiers_object_suffix))))
         output += '\n'
     output += utils.indent(utils.shorten(
         'Prepositions: {}'.format(str(self.prepositions))))
     output += '\n'
     if self.qualified_object:
         output += utils.indent(
             'Qualified Object: {}'.format(
                 repr(
                     self.qualified_object)))
         output += '\n'
     return output
コード例 #8
0
 def __str__(self):
     output = 'Predicate:'
     output += '\n'
     output += utils.indent('Index: {}'.format(self.index))
     output += '\n'
     output += utils.indent(utils.shorten(
         'Modifiers Prefix: {}'.format(str(self.verb_modifiers_prefix))))
     output += '\n'
     output += utils.indent('Prefix: {}'.format(self.verb_prefix))
     output += '\n'
     output += utils.indent('Verb: {}'.format(self.determiner))
     output += '\n'
     output += utils.indent('Suffix: {}'.format(self.verb_suffix))
     output += '\n'
     output += utils.indent(utils.shorten(
         'Modifiers Suffix: {}'.format(str(self.verb_modifiers_suffix))))
     output += '\n'
     return output
コード例 #9
0
 def __str__(self):
     output = 'Preposition:'
     output += '\n'
     output += utils.indent('Index: {}'.format(self.index))
     output += '\n'
     output += utils.indent(
         'Preposition Type: {}'.format(
             self.preposition_type))
     output += '\n'
     output += utils.indent(utils.shorten(
         'Preposition Prefix: {}'.format(str(self.preposition_prefix))))
     output += '\n'
     output += utils.indent('Preposition: {}'.format(self.preposition))
     output += '\n'
     output += utils.indent('Object: {}'.format(self.preposition_object))
     output += '\n'
     output += utils.indent(utils.shorten(
         'Nested Prepositions: {}'.format(str(self.nested_prepositions))))
     output += '\n'
     return output
コード例 #10
0
 def __str__(self):
     output = 'Entity:'
     output += '\n'
     output += utils.indent(
         'Possessive Entity: {}'.format(
             repr(
                 self.possessive_entity)))
     output += '\n'
     output += utils.indent('Index: {}'.format(self.index))
     output += '\n'
     output += utils.indent('Determiner: {}'.format(self.determiner))
     output += '\n'
     output += utils.indent(utils.shorten(
         'Modifiers Prefix: {}'.format(str(self.entity_modifiers_prefix))))
     output += '\n'
     output += utils.indent('Entity: {}'.format(self.entity))
     output += '\n'
     output += utils.indent(utils.shorten(
         'Modifiers Suffix: {}'.format(str(self.entity_modifiers_suffix))))
     output += '\n'
     return output