示例#1
0
class SpellingWindowRule(MappingRule):
    mapping = {
        # todo: make these CCR

        "<first_second_third> word":
            R(Key("home, c-right:%(first_second_third)d, cs-right"),
              rdescript="Dragon: select the first second or third etc. word"),
        "last [word]": R(Key("right, cs-left"), rdescript="Dragon: select the last word"),
        "second [to] last word": R(Key("right, c-left:1, cs-left"), rdescript="Dragon: select the second to last word"),
        "<n10>": R(Mimic("choose", extra="n10"),
                   rdescript="Dragon: e.g. instead of having to say 'choose two' you can just say 'two'"),
        # consider making the above command global so that it works when you say something like
        # "insert before 'hello'" where there are multiple instances of 'hello'
        # personally I think it's better just to have the setting where Dragon choose is the closest instance

    }

    # see above
    extras = extras_for_whole_file()
    defaults = defaults_for_whole_file()
示例#2
0
class DragonRule(MappingRule):
    mapping = {
        '(number|numbers) mode':
        R(Playback([(["numbers", "mode", "on"], 0.0)])),
        'spell mode':
        R(Playback([(["spell", "mode", "on"], 0.0)])),
        'dictation mode':
        R(Playback([(["dictation", "mode", "on"], 0.0)])),
        'normal mode':
        R(Playback([(["normal", "mode", "on"], 0.0)])),
        '(command mode | command on | com on)':
        R(Playback([(["command", "mode", "on"], 0.0)])),
        '(command off | com off)':
        R(Playback([(["command", "mode", "off"], 0.0)])),
        "fix dragon double":
        R(Function(fix_dragon_double)),
        "left point":
        R(
            Playback([(["MouseGrid"], 0.1), (["four", "four"], 0.1),
                      (["click"], 0.0)])),
        "right point":
        R(
            Playback([(["MouseGrid"], 0.1), (["six", "six"], 0.1),
                      (["click"], 0.0)])),
        "center point":
        R(Playback([(["MouseGrid"], 0.1), (["click"], 0.0)]),
          rdescript="Mouse: Center Point"),
        "show windows":
        R(Mimic("list", "all", "windows"),
          rdescript="Dragon: emulate Dragon command for listing windows"),
        "cory <text>":
        R(Mimic("correct", extra="text") +
          WaitWindow(title="spelling window") + Mimic("choose", "one"),
          rdescript=
          "Dragon: brings up the correction menu for the phrase spoken in the command and chooses the 1st choice"
          ),
        "cory that":
        R(Mimic("correct", "that") + WaitWindow(title="spelling window") +
          Mimic("choose", "one"),
          rdescript=
          "Dragon: brings up the correction menu for the previously spoken phrase and chooses the first choice"
          ),
        "make that <text>":
        R(Mimic("scratch", "that") + Mimic(extra="text"),
          rdescript=
          "Dragon: deletes the dictation generated by the previous utterance and replaces it with what you say next"
          ),
        "scratch [<n10>]":
        R(Playback([(["scratch", "that"], 0.03)]),
          rdescript="Dragon: delete dictation from previous n utterances") *
        Repeat(extra="n10"),

        # Users may want to adjust the wait time on the next few commands
        "train word":
        R(Mimic("train", "that") + Pause("75") + Key("a-r/250, s"),
          rdescript=
          "Dragon: quickly train word when you have it selected in a Dragon friendly text field"
          ),
        "word train":
        R(Key("c-c/20") + Mimic("edit", "vocabulary") +
          Key("c-v/5, tab, down, up, a-t/50, enter/50, a-r/250, s/50, escape"),
          rdescript=
          "train word quickly once you have it selected in non-full text control application"
          ),
        "(add train | train from add word)":
        R(Key("a-a/2, enter/300, a-s"),
          rdescript="Dragon: quickly train word from the add word dialogbox"),
        "(train from vocab | cab train)":
        R(Key("a-t/50, enter/50, a-r/250, s"),
          rdescript="Dragon: quickly train word from Vocabulary Editor"),
        "(train from vocab | cab train)":
        R(Key("a-t/50, enter/50, a-r/250, s"),
          rdescript="Dragon: quickly train word from Vocabulary Editor"),
        "remove from vocab":
        R(Key("c-c/5") + Mimic("edit", "vocabulary") + Pause("20") +
          Key("c-v/10, tab, down, up/5, a-d, y, escape/30, right"),
          rdescript="Dragon: remove selected word from vocabulary"),
        "(add to vocab | vocab that)":
        R(Key("c-c/5") + Mimic("add", "word") + Pause("20") +
          Key("c-v, a-a/2, enter/300, a-s/30, right"),
          rdescript="Dragon: add selected word to vocabulary and train it"),
        "recognition history":
        R(Playback([(["view", "recognition", "history"], 0.03)]),
          rdescript="Dragon: open Dragon recognition history"),
        "peak [recognition] history":
        R(Playback([(["view", "recognition", "history"], 0.03)]) +
          Pause("300") + Key("escape"),
          rdescript="Dragon: open Dragon recognition history then close it"),
        "[dictation] sources":
        R(Mimic("manage", "dictation", "sources"),
          rdescript="Dragon: manage dictation sources"),
    }
    # see above
    extras = extras_for_whole_file()
    defaults = defaults_for_whole_file()