コード例 #1
0
 def _execute(self, data=None):
     words1 = split_dictation(data["text"])
     words2 = split_dictation(data["text2"])
     camel1 = words1[0] + "".join(w.capitalize() for w in words1[1:])
     camel2 = words2[0] + "".join(w.capitalize() for w in words2[1:])
     action = self.prefix + Text(camel1) + self.middle + Text(
         camel2) + self.suffix
     action.execute()
コード例 #2
0
def format_spaces(dictation):
    """ spaces <dictation> """
    return " ".join(text.split_dictation(dictation))
コード例 #3
0
def format_dashes(dictation):
    """ dashes <dictation> """
    return "-".join(text.split_dictation(dictation))
コード例 #4
0
def format_camel(dictation):
    """ camel <dictation> """
    words = text.split_dictation(dictation)
    return words[0] + "".join(w.capitalize() for w in words[1:])
コード例 #5
0
def format_upper(dictation):
    """ upper <dictation> """
    words = [word.upper() for word in text.split_dictation(dictation)]
    return " ".join(words)
コード例 #6
0
def format_one_word(dictation):
    """ [all] one word <dictation> """
    return "".join(text.split_dictation(dictation))
コード例 #7
0
def format_pascal(dictation):
    """ studley <dictation> """
    words = [word.capitalize() for words in text.split_dictation(dictation)
             for word in re.findall(r"(\W+|\w+)", words)]
    return "".join(words)
コード例 #8
0
def format_score(dictation):          # Function name must start with "format_".
    """ score <dictation> """         # Docstring defining spoken-form.
    return "_".join(text.split_dictation(dictation))  # Put underscores between words.
コード例 #9
0
 def _execute(self, data=None):
     words = split_dictation(data["text"], self.preprocess)
     formatted_words = self.formatter(words)
     action = self.prefix + Text(formatted_words) + self.suffix
     action.execute()