コード例 #1
0
 def get_easy_prompt(self):
     """
     Convert an selfession into a prompt
     """
     parts = ["%s"%(round_multiplier(self.multiplier))] + [
              self.__ndata_to_string(arg) 
              for arg in reversed(self.get_arguments())]
     return " * ".join(parts)
コード例 #2
0
 def get_prompt(self):
     """
     Convert an selfession into a prompt
     """
     parts = ["<u><b>%s</b></u>"%(round_multiplier(self.multiplier))] + [
              self.__ndata_to_html(arg) 
              for arg in reversed(self.get_arguments())]
     return self.get_z() + " &asymp; " + " &times; ".join(parts)
コード例 #3
0
    def perspective(self):
        """
        Baseline perspective:
        Generate a natural language description of a expr.
        If multiplier > 1: prepend "multipler times the "
        If multiplier < 1: prepend "multipler of the "
        If multiplier == 1: prepend "the "
        """
        output = ""

        # say the multiplier
        multiplier = round_multiplier(self.multiplier)
        if multiplier == "1/1" or multiplier == "1":
            pass
        elif "/" in multiplier:
            output += multiplier + " of "
        else:
            output += multiplier + " times "
        output += "the "

        # append descriptions of each expression to the output
        output += " for ".join(arg.name for arg in reversed(self.get_arguments()))
        return output
コード例 #4
0
 def get_easy_prompt_no_units(self):
     """
     Convert an selfession into a prompt
     """
     parts = ["%s"%(round_multiplier(self.multiplier))] + ["%s"%(arg.name) for arg in reversed(self.get_arguments())]
     return " * ".join(parts)