def __commandSuggestionCaption(self, userText): """ Creates and returns a caption suggesting one or two commands that are similar to userText. """ # Retrieve one or two command name suggestions. suggestions = self.__cmdManager.retrieveSuggestions(userText) cmds = [s.toText() for s in suggestions] if len(cmds) > 0: ratioBestMatch = stringRatioBestMatch(userText.lower(), cmds) caption = config.ONE_SUGG_CAPTION caption = caption % ratioBestMatch else: # There were no suggestions; so we don't want a caption. caption = "" return caption
def __commandSuggestionCaption( self, userText ): """ Creates and returns a caption suggesting one or two commands that are similar to userText. """ # Retrieve one or two command name suggestions. suggestions = self.__cmdManager.retrieveSuggestions( userText ) cmds = [ s.toText() for s in suggestions ] if len(cmds) > 0: ratioBestMatch = stringRatioBestMatch( userText.lower(), cmds ) caption = config.ONE_SUGG_CAPTION caption = caption % ratioBestMatch else: # There were no suggestions; so we don't want a caption. caption = "" return caption