Пример #1
0
    def describe(self, limit=5, include_negative=True):
        summary = self.summarize()
        if summary['stmt_type'] is None:
            verb_wrap = ' can affect '
            ps = super(ToTarget, self).describe(limit=limit,
                                                include_negative=False)
        else:
            verb_wrap = ' can %s ' % summary['stmt_type']
            ps = ''

        desc = "Overall, I found that"
        other_names = [a.name for a in summary['other_agents']]
        if len(other_names) > limit:
            desc += ', for example, '
            desc += english_join(other_names[:limit])
        elif 0 < len(other_names) <= limit:
            desc += ' ' + english_join(other_names)
        elif include_negative:
            desc += ' nothing'
        else:
            return None

        desc += verb_wrap
        desc += summary['query_obj'].name + '. '

        if ps:
            desc += ps
        return desc
Пример #2
0
 def describe(self, *args, **kwargs):
     summary = self.summarize()
     desc = "Overall, I found that %s have the following common %s: %s" \
            % (english_join([ag.name for ag in summary['query_agents']]),
               summary['query_direction'],
               english_join(summary['other_agent_names']))
     return desc
Пример #3
0
    def describe(self, limit=10, include_negative=True):
        summary = self.summarize()
        if summary['stmt_type'] is None:
            verb_wrap = ' can affect '
            ps = super(FromSource, self).describe(limit=limit,
                                                  include_negative=False)
        else:
            verb_wrap = ' can %s ' % summary['stmt_type']
            ps = ''
        desc = "Overall, I found that " + summary['query_subj'].name + \
               verb_wrap
        other_names = [a.name for a in summary['other_agents']]

        if len(other_names) > limit:
            # We trim the trailing space of desc here before appending
            desc = desc[:-1] + ', for example, '
            desc += english_join(other_names[:limit]) + '. '
        elif 0 < len(other_names) <= limit:
            desc += english_join(other_names) + '. '
        elif include_negative:
            desc += 'nothing. '
        else:
            desc = None

        if ps:
            desc += ps
        return desc
Пример #4
0
 def describe(self, limit=None, include_negative=True):
     summary = self.summarize()
     names = [ag.name for ag in summary['query_agents']]
     if summary['stmt_types']:
         desc = "Overall, I found that %s and %s interact in the " \
                "following ways: " % tuple(names)
         desc += (english_join(summary['stmt_types']) + '.')
     elif include_negative:
         desc = 'I couldn\'t find evidence that %s and %s interact.' \
                % tuple(names)
     else:
         desc = None
     return desc
Пример #5
0
 def describe(self, limit=None, include_negative=True):
     summary = self.summarize()
     if summary['stmt_types']:
         desc = "Overall, I found that %s can %s %s." % \
                (summary['query_subj'].name,
                 english_join(summary['stmt_types']),
                 summary['query_obj'].name)
     elif include_negative:
         desc = 'Overall, I found that %s does not affect %s.' % \
             (summary['query_subj'].name, summary['query_obj'].name)
     else:
         desc = None
     return desc
Пример #6
0
    def describe(self, max_names=20, include_negative=True):
        summary = self.summarize()
        desc = "Overall, I found that %s can be in a complex with " % \
               summary['query_agent'].name

        other_agents = [a.name for a in summary['other_agents'][:max_names]]
        if other_agents:
            desc += english_join(other_agents)
        elif include_negative:
            desc += 'nothing'
        else:
            return None

        desc += '.'
        return desc
Пример #7
0
    def describe(self, max_names=20, include_negative=True):
        summary = self.summarize()
        desc = ('Overall, I found that %s interacts with%s ' %
                (summary['query_agent'].name, ', for instance,'
                 if len(summary['other_agents']) > max_names else ''))
        if summary['other_agents'][:max_names]:
            desc += english_join(
                [a.name for a in summary['other_agents'][:max_names]])
        elif include_negative:
            desc += 'nothing'
        else:
            return None

        desc += '. '
        desc += super(Neighborhood, self).describe(include_negative=False)
        return desc