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