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()
def format_spaces(dictation): """ spaces <dictation> """ return " ".join(text.split_dictation(dictation))
def format_dashes(dictation): """ dashes <dictation> """ return "-".join(text.split_dictation(dictation))
def format_camel(dictation): """ camel <dictation> """ words = text.split_dictation(dictation) return words[0] + "".join(w.capitalize() for w in words[1:])
def format_upper(dictation): """ upper <dictation> """ words = [word.upper() for word in text.split_dictation(dictation)] return " ".join(words)
def format_one_word(dictation): """ [all] one word <dictation> """ return "".join(text.split_dictation(dictation))
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)
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.
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()