Updated to use WSR and python 3
parent
924ea4902f
commit
34214ca2aa
|
@ -1,2 +1,3 @@
|
||||||
__pycache__/
|
__pycache__/
|
||||||
*.py[cod]
|
*.py[cod]
|
||||||
|
dfly-loader-wsr.py
|
||||||
|
|
|
@ -16,7 +16,7 @@ class AngularEnabler(CompoundRule):
|
||||||
AngularBootstrap.disable()
|
AngularBootstrap.disable()
|
||||||
AngularGrammar.enable()
|
AngularGrammar.enable()
|
||||||
s = "Angular JS grammar activated"
|
s = "Angular JS grammar activated"
|
||||||
print s
|
print (s)
|
||||||
speaker.Speak(s)
|
speaker.Speak(s)
|
||||||
|
|
||||||
class AngularDisabler(CompoundRule):
|
class AngularDisabler(CompoundRule):
|
||||||
|
@ -26,14 +26,14 @@ class AngularDisabler(CompoundRule):
|
||||||
AngularGrammar.disable()
|
AngularGrammar.disable()
|
||||||
AngularBootstrap.enable()
|
AngularBootstrap.enable()
|
||||||
s = "Angular JS grammar deactivated"
|
s = "Angular JS grammar deactivated"
|
||||||
print s
|
print (s)
|
||||||
speaker.Speak(s)
|
speaker.Speak(s)
|
||||||
|
|
||||||
class AngularTestRule(CompoundRule):
|
class AngularTestRule(CompoundRule):
|
||||||
spec = "test Angular" # Spoken form of command.
|
spec = "test Angular" # Spoken form of command.
|
||||||
|
|
||||||
def _process_recognition(self, node, extras): # Callback when command is spoken.
|
def _process_recognition(self, node, extras): # Callback when command is spoken.
|
||||||
print "Angular JS grammar tested"
|
print ("Angular JS grammar tested")
|
||||||
|
|
||||||
class AngularControlStructures(MappingRule):
|
class AngularControlStructures(MappingRule):
|
||||||
|
|
||||||
|
|
|
@ -6,31 +6,31 @@ from dragonfly import (Grammar, CompoundRule, Dictation, Text, Key, AppContext,
|
||||||
|
|
||||||
class CPPEnabler(CompoundRule):
|
class CPPEnabler(CompoundRule):
|
||||||
spec = "Enable CPP" # note: this command couldn't be "enable C++" because it causes problems with the grammar engine due to complexity.
|
spec = "Enable CPP" # note: this command couldn't be "enable C++" because it causes problems with the grammar engine due to complexity.
|
||||||
|
|
||||||
def _process_recognition(self, node, extras): # Callback when command is spoken.
|
def _process_recognition(self, node, extras): # Callback when command is spoken.
|
||||||
CPPBootstrap.disable()
|
CPPBootstrap.disable()
|
||||||
CPPGrammar.enable()
|
CPPGrammar.enable()
|
||||||
print "C++ grammar enabled"
|
print ("C++ grammar enabled")
|
||||||
|
|
||||||
class CPPDisabler(CompoundRule):
|
class CPPDisabler(CompoundRule):
|
||||||
spec = "switch language" # Spoken form of command.
|
spec = "switch language" # Spoken form of command.
|
||||||
|
|
||||||
def _process_recognition(self, node, extras): # Callback when command is spoken.
|
def _process_recognition(self, node, extras): # Callback when command is spoken.
|
||||||
CPPGrammar.disable()
|
CPPGrammar.disable()
|
||||||
CPPBootstrap.enable()
|
CPPBootstrap.enable()
|
||||||
print "C++ grammar disabled"
|
print ("C++ grammar disabled")
|
||||||
|
|
||||||
|
|
||||||
# test rule to see if this script is working
|
# test rule to see if this script is working
|
||||||
class CPPTestRule(CompoundRule):
|
class CPPTestRule(CompoundRule):
|
||||||
spec = "test CPP" # Spoken form of command.
|
spec = "test CPP" # Spoken form of command.
|
||||||
|
|
||||||
def _process_recognition(self, node, extras): # Callback when command is spoken.
|
def _process_recognition(self, node, extras): # Callback when command is spoken.
|
||||||
print "C++ grammar tested"
|
print ("C++ grammar tested")
|
||||||
|
|
||||||
#Rules for implementing control structures in C++
|
#Rules for implementing control structures in C++
|
||||||
class CPPControlStructures(MappingRule):
|
class CPPControlStructures(MappingRule):
|
||||||
|
|
||||||
mapping = {
|
mapping = {
|
||||||
"code block": Text("{") + Key("enter")+ Key("enter") + Text("}"),
|
"code block": Text("{") + Key("enter")+ Key("enter") + Text("}"),
|
||||||
"if": Text("if()") + Key("enter")+ Key("enter") + Text("}"),
|
"if": Text("if()") + Key("enter")+ Key("enter") + Text("}"),
|
||||||
|
@ -41,15 +41,15 @@ class CPPControlStructures(MappingRule):
|
||||||
"for loop": Text("for(;;) {") + Key("enter")+ Key("enter") + Text("}"),
|
"for loop": Text("for(;;) {") + Key("enter")+ Key("enter") + Text("}"),
|
||||||
"switch statement": Text("switch() {") + Key("enter")+ Key("enter") + Text("}"),
|
"switch statement": Text("switch() {") + Key("enter")+ Key("enter") + Text("}"),
|
||||||
"try catch": Text("try {") + Key("enter")+ Key("enter") + Text("}") + Key("enter") + Text("catch() {") + Key("enter")+ Key("enter") + Text("}"),
|
"try catch": Text("try {") + Key("enter")+ Key("enter") + Text("}") + Key("enter") + Text("catch() {") + Key("enter")+ Key("enter") + Text("}"),
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#Some syntax rules for functions, classes, etc. in C++
|
#Some syntax rules for functions, classes, etc. in C++
|
||||||
class CPPFunctionsAndClassesSyntax(MappingRule):
|
class CPPFunctionsAndClassesSyntax(MappingRule):
|
||||||
|
|
||||||
mapping = {
|
mapping = {
|
||||||
#function syntax stuff
|
#function syntax stuff
|
||||||
"function prototype": Text("returnType functionName();"),
|
"function prototype": Text("returnType functionName();"),
|
||||||
"function": Text("returnType functionName() {")+Key("enter")+ Key("enter")+ Text("}"),
|
"function": Text("returnType functionName() {")+Key("enter")+ Key("enter")+ Text("}"),
|
||||||
#miscellaneous syntax stuff
|
#miscellaneous syntax stuff
|
||||||
|
@ -62,16 +62,16 @@ class CPPFunctionsAndClassesSyntax(MappingRule):
|
||||||
"class": Text("class ClassName {") + Key("enter")+ Text("public:")+ Key("enter") + Key("enter") + Text("};"),
|
"class": Text("class ClassName {") + Key("enter")+ Text("public:")+ Key("enter") + Key("enter") + Text("};"),
|
||||||
"constructor": Text("();") + Key("left")+ Key("left")+ Key("left"),
|
"constructor": Text("();") + Key("left")+ Key("left")+ Key("left"),
|
||||||
"destructor": Text("~();") + Key("left")+ Key("left")+ Key("left"),
|
"destructor": Text("~();") + Key("left")+ Key("left")+ Key("left"),
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class CPPOperators(MappingRule):
|
class CPPOperators(MappingRule):
|
||||||
|
|
||||||
mapping = {
|
mapping = {
|
||||||
"scope operator": Text("::"),
|
"scope operator": Text("::"),
|
||||||
|
|
||||||
"plus plus": Text("++"),
|
"plus plus": Text("++"),
|
||||||
"minus minus": Text("--"),
|
"minus minus": Text("--"),
|
||||||
"plus": Text("+"),
|
"plus": Text("+"),
|
||||||
|
@ -91,9 +91,9 @@ class CPPOperators(MappingRule):
|
||||||
"logical or": Text("||"),
|
"logical or": Text("||"),
|
||||||
"plus equals": Text("+="),
|
"plus equals": Text("+="),
|
||||||
"minus equals": Text("-="),
|
"minus equals": Text("-="),
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#Handles the C++ commenting syntax
|
#Handles the C++ commenting syntax
|
||||||
class CPPCommentsSyntax(MappingRule):
|
class CPPCommentsSyntax(MappingRule):
|
||||||
|
@ -101,7 +101,7 @@ class CPPCommentsSyntax(MappingRule):
|
||||||
mapping = {
|
mapping = {
|
||||||
"comment": Text("// "),
|
"comment": Text("// "),
|
||||||
"multiline comment": Text("/*") + Key("enter") + Key("enter") + Text("*/") + Key("up")
|
"multiline comment": Text("/*") + Key("enter") + Key("enter") + Text("*/") + Key("up")
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#Some useful miscellaneous C++ functions
|
#Some useful miscellaneous C++ functions
|
||||||
|
@ -111,8 +111,8 @@ class CPPUsefulFunctions(MappingRule):
|
||||||
"print statement": Text("cout << ;") + Key("left"),
|
"print statement": Text("cout << ;") + Key("left"),
|
||||||
"input statement": Text("cin >> ;") + Key("left"),
|
"input statement": Text("cin >> ;") + Key("left"),
|
||||||
"end line": Text("endl"),
|
"end line": Text("endl"),
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#Syntax for preprocessor directives in C++
|
#Syntax for preprocessor directives in C++
|
||||||
|
@ -131,7 +131,7 @@ class CPPPreprocessorDirectives(MappingRule):
|
||||||
"directive undefine": Text("#undef "),
|
"directive undefine": Text("#undef "),
|
||||||
"directive error": Text("#error"),
|
"directive error": Text("#error"),
|
||||||
"directive line": Text("#line ")
|
"directive line": Text("#line ")
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -152,7 +152,7 @@ class CPPDataTypes(MappingRule):
|
||||||
"constant": Text("const "),
|
"constant": Text("const "),
|
||||||
"null": Text("NULL"),
|
"null": Text("NULL"),
|
||||||
|
|
||||||
#my attempt at a C++ script for shortcut float notation
|
#my attempt at a C++ script for shortcut float notation
|
||||||
"<n> point <n2> float": Text("%(n)d.%(n2)d") + Text("f"),
|
"<n> point <n2> float": Text("%(n)d.%(n2)d") + Text("f"),
|
||||||
"<n> point <n2> <n3> float": Text("%(n)d.%(n2)d%(n3)d") + Text("f"),
|
"<n> point <n2> <n3> float": Text("%(n)d.%(n2)d%(n3)d") + Text("f"),
|
||||||
"<n> point <n2> <n3> <n4> float": Text("%(n)d.%(n2)d%(n3)d%(n4)d") + Text("f"),
|
"<n> point <n2> <n3> <n4> float": Text("%(n)d.%(n2)d%(n3)d%(n4)d") + Text("f"),
|
||||||
|
@ -170,11 +170,11 @@ class CPPEscapeSequences(MappingRule):
|
||||||
"escape quotes": Text("\ ")+ Key("left") + Text("\"") + Text("\ ")+ Key("left") + Text("\""),
|
"escape quotes": Text("\ ")+ Key("left") + Text("\"") + Text("\ ")+ Key("left") + Text("\""),
|
||||||
"escape single quotes": Text("\ ")+ Key("left") + Text("\'") + Text("\ ")+ Key("left") + Text("\'"),
|
"escape single quotes": Text("\ ")+ Key("left") + Text("\'") + Text("\ ")+ Key("left") + Text("\'"),
|
||||||
"escape line": Text("\ ")+ Key("left") + Text("n"),
|
"escape line": Text("\ ")+ Key("left") + Text("n"),
|
||||||
"escape tab": Text("\ ")+ Key("left") + Text("t"),
|
"escape tab": Text("\ ")+ Key("left") + Text("t"),
|
||||||
"escape carriage return": Text("\ ")+ Key("left") + Text("r"),
|
"escape carriage return": Text("\ ")+ Key("left") + Text("r"),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
CPPBootstrap = Grammar("C++ bootstrap") # Create a grammar to contain the command rule.
|
CPPBootstrap = Grammar("C++ bootstrap") # Create a grammar to contain the command rule.
|
||||||
CPPBootstrap.add_rule(CPPEnabler())
|
CPPBootstrap.add_rule(CPPEnabler())
|
||||||
|
@ -198,4 +198,4 @@ CPPGrammar.disable()
|
||||||
def unload():
|
def unload():
|
||||||
global CPPGrammar
|
global CPPGrammar
|
||||||
if CPPGrammar: CPPGrammar.unload()
|
if CPPGrammar: CPPGrammar.unload()
|
||||||
CPPGrammar = None
|
CPPGrammar = None
|
||||||
|
|
|
@ -5,26 +5,26 @@ from dragonfly import (Grammar, CompoundRule, Dictation, Text, Key, AppContext,
|
||||||
|
|
||||||
class CSEnabler(CompoundRule):
|
class CSEnabler(CompoundRule):
|
||||||
spec = "Enable C sharp" # Spoken form of command.
|
spec = "Enable C sharp" # Spoken form of command.
|
||||||
|
|
||||||
def _process_recognition(self, node, extras): # Callback when command is spoken.
|
def _process_recognition(self, node, extras): # Callback when command is spoken.
|
||||||
csBootstrap.disable()
|
csBootstrap.disable()
|
||||||
csGrammar.enable()
|
csGrammar.enable()
|
||||||
print "C# grammar enabled"
|
print ("C# grammar enabled")
|
||||||
|
|
||||||
class CSDisabler(CompoundRule):
|
class CSDisabler(CompoundRule):
|
||||||
spec = "switch language" # Spoken form of command.
|
spec = "switch language" # Spoken form of command.
|
||||||
|
|
||||||
def _process_recognition(self, node, extras): # Callback when command is spoken.
|
def _process_recognition(self, node, extras): # Callback when command is spoken.
|
||||||
csGrammar.disable()
|
csGrammar.disable()
|
||||||
csBootstrap.enable()
|
csBootstrap.enable()
|
||||||
print "C# grammar disabled"
|
print ("C# grammar disabled")
|
||||||
|
|
||||||
# This is a test rule to see if the C# grammar is enabled
|
# This is a test rule to see if the C# grammar is enabled
|
||||||
class CSTestRule(CompoundRule):
|
class CSTestRule(CompoundRule):
|
||||||
spec = "test C sharp" # Spoken form of command.
|
spec = "test C sharp" # Spoken form of command.
|
||||||
|
|
||||||
def _process_recognition(self, node, extras): # Callback when command is spoken.
|
def _process_recognition(self, node, extras): # Callback when command is spoken.
|
||||||
print "C# grammar tested"
|
print ("C# grammar tested")
|
||||||
|
|
||||||
# Handles C# commenting syntax
|
# Handles C# commenting syntax
|
||||||
class CSCommentsSyntax(MappingRule):
|
class CSCommentsSyntax(MappingRule):
|
||||||
|
@ -32,7 +32,7 @@ class CSCommentsSyntax(MappingRule):
|
||||||
mapping = {
|
mapping = {
|
||||||
"comment": Text("// "),
|
"comment": Text("// "),
|
||||||
"multiline comment": Text("/*") + Key("enter") + Key("enter") + Text("*/") + Key("up")
|
"multiline comment": Text("/*") + Key("enter") + Key("enter") + Text("*/") + Key("up")
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Deals with printing C# datatypes
|
# Deals with printing C# datatypes
|
||||||
|
@ -50,7 +50,7 @@ class CSDataTypes(MappingRule):
|
||||||
}
|
}
|
||||||
extras = [
|
extras = [
|
||||||
Integer("n", 0, 64)
|
Integer("n", 0, 64)
|
||||||
|
|
||||||
]
|
]
|
||||||
|
|
||||||
# This rule deals with the C# comparison operators
|
# This rule deals with the C# comparison operators
|
||||||
|
@ -63,7 +63,7 @@ class CSComparisonOperators(MappingRule):
|
||||||
"less than": Text("<"),
|
"less than": Text("<"),
|
||||||
"less than or equal to": Text("<="),
|
"less than or equal to": Text("<="),
|
||||||
"greater than or equal to": Text(">="),
|
"greater than or equal to": Text(">="),
|
||||||
|
|
||||||
}
|
}
|
||||||
# This rule deals with the C# Boolean operators
|
# This rule deals with the C# Boolean operators
|
||||||
class CSBooleanOperators(MappingRule):
|
class CSBooleanOperators(MappingRule):
|
||||||
|
@ -74,12 +74,12 @@ class CSBooleanOperators(MappingRule):
|
||||||
"true": Text("true"),
|
"true": Text("true"),
|
||||||
"false": Text("false"),
|
"false": Text("false"),
|
||||||
"not": Text("!")
|
"not": Text("!")
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class CSControlStructures(MappingRule):
|
class CSControlStructures(MappingRule):
|
||||||
|
|
||||||
mapping = {
|
mapping = {
|
||||||
"code block": Text("{") + Key("enter")+ Key("enter") + Text("}"),
|
"code block": Text("{") + Key("enter")+ Key("enter") + Text("}"),
|
||||||
"if": Text("if() {") + Key("enter")+ Key("enter") + Text("}"),
|
"if": Text("if() {") + Key("enter")+ Key("enter") + Text("}"),
|
||||||
|
@ -95,14 +95,14 @@ class CSControlStructures(MappingRule):
|
||||||
"interface": Text("<access modifier> interface InterfaceName {") + Key("enter")+ Key("enter") + Text("}"),
|
"interface": Text("<access modifier> interface InterfaceName {") + Key("enter")+ Key("enter") + Text("}"),
|
||||||
"enumeration": Text("<access modifier> enum EnumName {") + Key("enter")+ Key("enter") + Text("}"),
|
"enumeration": Text("<access modifier> enum EnumName {") + Key("enter")+ Key("enter") + Text("}"),
|
||||||
"method": Text("<datatype> methodName() {") + Key("enter") + Key("enter") + Text("}"),
|
"method": Text("<datatype> methodName() {") + Key("enter") + Key("enter") + Text("}"),
|
||||||
|
|
||||||
}
|
}
|
||||||
# This rule provides some useful method calls in C#
|
# This rule provides some useful method calls in C#
|
||||||
class CSUsefulMethods(MappingRule):
|
class CSUsefulMethods(MappingRule):
|
||||||
|
|
||||||
mapping = {
|
mapping = {
|
||||||
"print statement": Text("Console.WriteLine()") + Key("left"),
|
"print statement": Text("Console.WriteLine()") + Key("left"),
|
||||||
|
|
||||||
}
|
}
|
||||||
# This rule deals with some of the C# arithmetic operators
|
# This rule deals with some of the C# arithmetic operators
|
||||||
class CSArithmeticOperators(MappingRule):
|
class CSArithmeticOperators(MappingRule):
|
||||||
|
@ -115,7 +115,7 @@ class CSArithmeticOperators(MappingRule):
|
||||||
"minus": Text("-"),
|
"minus": Text("-"),
|
||||||
"divided by": Text("/"),
|
"divided by": Text("/"),
|
||||||
"modulus": Text("%") #causes some weird problem in dragonfly so this doesn't work, use "percent sign" instead
|
"modulus": Text("%") #causes some weird problem in dragonfly so this doesn't work, use "percent sign" instead
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class CSAssignmentOperators(MappingRule):
|
class CSAssignmentOperators(MappingRule):
|
||||||
|
@ -125,16 +125,16 @@ class CSAssignmentOperators(MappingRule):
|
||||||
"minus equals": Text("-="),
|
"minus equals": Text("-="),
|
||||||
"multiply equals": Text("*="),
|
"multiply equals": Text("*="),
|
||||||
"divide equals": Text("/="),
|
"divide equals": Text("/="),
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class CSMiscellaneousStuff(MappingRule):
|
class CSMiscellaneousStuff(MappingRule):
|
||||||
|
|
||||||
mapping = {
|
mapping = {
|
||||||
"equals": Text(" = "),
|
"equals": Text(" = "),
|
||||||
"new": Text("new "),
|
"new": Text("new "),
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class CSAccessModifiers(MappingRule):
|
class CSAccessModifiers(MappingRule):
|
||||||
|
@ -143,7 +143,7 @@ class CSAccessModifiers(MappingRule):
|
||||||
"public": Text("public "),
|
"public": Text("public "),
|
||||||
"private": Text("private "),
|
"private": Text("private "),
|
||||||
"protected": Text("protected ")
|
"protected": Text("protected ")
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class CSEscapeSequences(MappingRule):
|
class CSEscapeSequences(MappingRule):
|
||||||
|
@ -152,12 +152,12 @@ class CSEscapeSequences(MappingRule):
|
||||||
"escape quotes": Text("\ ")+ Key("left") + Text("\"") + Text("\ ")+ Key("left") + Text("\""),
|
"escape quotes": Text("\ ")+ Key("left") + Text("\"") + Text("\ ")+ Key("left") + Text("\""),
|
||||||
"escape single quotes": Text("\ ")+ Key("left") + Text("\'") + Text("\ ")+ Key("left") + Text("\'"),
|
"escape single quotes": Text("\ ")+ Key("left") + Text("\'") + Text("\ ")+ Key("left") + Text("\'"),
|
||||||
"escape line": Text("\ ")+ Key("left") + Text("n"),
|
"escape line": Text("\ ")+ Key("left") + Text("n"),
|
||||||
"escape tab": Text("\ ")+ Key("left") + Text("t"),
|
"escape tab": Text("\ ")+ Key("left") + Text("t"),
|
||||||
"escape carriage return": Text("\ ")+ Key("left") + Text("r"),
|
"escape carriage return": Text("\ ")+ Key("left") + Text("r"),
|
||||||
}
|
}
|
||||||
|
|
||||||
# The main C# grammar rules are activated here
|
# The main C# grammar rules are activated here
|
||||||
csBootstrap = Grammar("C sharp bootstrap")
|
csBootstrap = Grammar("C sharp bootstrap")
|
||||||
csBootstrap.add_rule(CSEnabler())
|
csBootstrap.add_rule(CSEnabler())
|
||||||
csBootstrap.load()
|
csBootstrap.load()
|
||||||
|
|
||||||
|
@ -183,4 +183,4 @@ csGrammar.disable()
|
||||||
def unload():
|
def unload():
|
||||||
global csGrammar
|
global csGrammar
|
||||||
if csGrammar: csGrammar.unload()
|
if csGrammar: csGrammar.unload()
|
||||||
csGrammar = None
|
csGrammar = None
|
||||||
|
|
|
@ -16,7 +16,7 @@ class CSSEnabler(CompoundRule):
|
||||||
def _process_recognition(self, node, extras): # Callback when command is spoken.
|
def _process_recognition(self, node, extras): # Callback when command is spoken.
|
||||||
cssBootstrap.disable()
|
cssBootstrap.disable()
|
||||||
cssGrammar.enable()
|
cssGrammar.enable()
|
||||||
print "CSS grammar enabled"
|
print ("CSS grammar enabled")
|
||||||
|
|
||||||
class CSSDisabler(CompoundRule):
|
class CSSDisabler(CompoundRule):
|
||||||
spec = "switch language" # Spoken form of command.
|
spec = "switch language" # Spoken form of command.
|
||||||
|
@ -24,14 +24,14 @@ class CSSDisabler(CompoundRule):
|
||||||
def _process_recognition(self, node, extras): # Callback when command is spoken.
|
def _process_recognition(self, node, extras): # Callback when command is spoken.
|
||||||
cssGrammar.disable()
|
cssGrammar.disable()
|
||||||
cssBootstrap.enable()
|
cssBootstrap.enable()
|
||||||
print "CSS grammar disabled"
|
print ("CSS grammar disabled")
|
||||||
|
|
||||||
|
|
||||||
class CSSTestRule(CompoundRule):
|
class CSSTestRule(CompoundRule):
|
||||||
spec = "test CSS" # Spoken form of command.
|
spec = "test CSS" # Spoken form of command.
|
||||||
|
|
||||||
def _process_recognition(self, node, extras): # Callback when command is spoken.
|
def _process_recognition(self, node, extras): # Callback when command is spoken.
|
||||||
print "CSS grammar tested"
|
print ("CSS grammar tested")
|
||||||
|
|
||||||
class CSSSelectors(MappingRule):
|
class CSSSelectors(MappingRule):
|
||||||
mapping = {
|
mapping = {
|
||||||
|
|
34
_firefox.py
34
_firefox.py
|
@ -8,42 +8,36 @@
|
||||||
Command-module for **Firefox**
|
Command-module for **Firefox**
|
||||||
============================================================================
|
============================================================================
|
||||||
|
|
||||||
This module offers direct control of the `Firefox
|
This module offers direct control of the `Firefox
|
||||||
<http://www.mozilla.com/en-US/firefox/>`_ web browser. It
|
<http://www.mozilla.com/en-US/firefox/>`_ web browser. It
|
||||||
requires the `mouseless-browsing
|
requires the `mouseless-browsing
|
||||||
<https://addons.mozilla.org/en-US/firefox/addon/879>`_
|
<https://addons.mozilla.org/en-US/firefox/addon/879>`_
|
||||||
(mlb) add-on for reliable access to hyperlinks.
|
(mlb) add-on for reliable access to hyperlinks.
|
||||||
|
|
||||||
This module includes direct searching using Firefox's
|
This module includes direct searching using Firefox's
|
||||||
search bar and Firefox's keyword searching. It also
|
search bar and Firefox's keyword searching. It also
|
||||||
allows single-utterance submitting of text into form text
|
allows single-utterance submitting of text into form text
|
||||||
fields.
|
fields.
|
||||||
|
|
||||||
Installation
|
Installation
|
||||||
----------------------------------------------------------------------------
|
----------------------------------------------------------------------------
|
||||||
|
|
||||||
If you are using DNS and Natlink, simply place this file in you Natlink
|
If you are using DNS and Natlink, simply place this file in you Natlink
|
||||||
macros directory. It will then be automatically loaded by Natlink when
|
macros directory. It will then be automatically loaded by Natlink when
|
||||||
you next toggle your microphone or restart Natlink.
|
you next toggle your microphone or restart Natlink.
|
||||||
|
|
||||||
Customization
|
Customization
|
||||||
----------------------------------------------------------------------------
|
----------------------------------------------------------------------------
|
||||||
|
|
||||||
Users should customize this module by editing its
|
Users should customize this module by editing its
|
||||||
configuration file. In this file they should edit the
|
configuration file. In this file they should edit the
|
||||||
``search.searchbar`` and ``search.keywords`` settings to
|
``search.searchbar`` and ``search.keywords`` settings to
|
||||||
match their own personal search preferences. These
|
match their own personal search preferences. These
|
||||||
variables map *what you say* to which *search engines* to
|
variables map *what you say* to which *search engines* to
|
||||||
use.
|
use.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
try:
|
|
||||||
import pkg_resources
|
|
||||||
pkg_resources.require("dragonfly >= 0.6.5beta1.dev-r76")
|
|
||||||
except ImportError:
|
|
||||||
pass
|
|
||||||
|
|
||||||
from dragonfly import *
|
from dragonfly import *
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -7,13 +7,13 @@ import win32com.client
|
||||||
speaker = win32com.client.Dispatch("SAPI.SpVoice")
|
speaker = win32com.client.Dispatch("SAPI.SpVoice")
|
||||||
|
|
||||||
class HTMLEnabler(CompoundRule):
|
class HTMLEnabler(CompoundRule):
|
||||||
spec = "Activate HTML" # Spoken form of command.
|
spec = "Activate html" # Spoken form of command.
|
||||||
|
|
||||||
def _process_recognition(self, node, extras): # Callback when command is spoken.
|
def _process_recognition(self, node, extras): # Callback when command is spoken.
|
||||||
htmlBootstrap.disable()
|
htmlBootstrap.disable()
|
||||||
htmlGrammar.enable()
|
htmlGrammar.enable()
|
||||||
s = "HTML grammar activated"
|
s = "HTML grammar activated"
|
||||||
print s
|
print (s)
|
||||||
speaker.Speak(s)
|
speaker.Speak(s)
|
||||||
class HTMLDisabler(CompoundRule):
|
class HTMLDisabler(CompoundRule):
|
||||||
spec = "switch language" # Spoken form of command.
|
spec = "switch language" # Spoken form of command.
|
||||||
|
@ -22,14 +22,14 @@ class HTMLDisabler(CompoundRule):
|
||||||
htmlGrammar.disable()
|
htmlGrammar.disable()
|
||||||
htmlBootstrap.enable()
|
htmlBootstrap.enable()
|
||||||
s = "HTML grammar deactivated"
|
s = "HTML grammar deactivated"
|
||||||
print s
|
print (s)
|
||||||
speaker.Speak(s)
|
speaker.Speak(s)
|
||||||
|
|
||||||
class HTMLTestRule(CompoundRule):
|
class HTMLTestRule(CompoundRule):
|
||||||
spec = "test HTML" # Spoken form of command.
|
spec = "test HTML" # Spoken form of command.
|
||||||
|
|
||||||
def _process_recognition(self, node, extras): # Callback when command is spoken.
|
def _process_recognition(self, node, extras): # Callback when command is spoken.
|
||||||
print "HTML grammar tested"
|
print ("HTML grammar tested")
|
||||||
|
|
||||||
|
|
||||||
class HTMLTags(MappingRule):
|
class HTMLTags(MappingRule):
|
||||||
|
|
|
@ -5,26 +5,26 @@ from dragonfly import (Grammar, CompoundRule, Dictation, Text, Key, AppContext,
|
||||||
|
|
||||||
class JavaEnabler(CompoundRule):
|
class JavaEnabler(CompoundRule):
|
||||||
spec = "Enable Java" # Spoken form of command.
|
spec = "Enable Java" # Spoken form of command.
|
||||||
|
|
||||||
def _process_recognition(self, node, extras): # Callback when command is spoken.
|
def _process_recognition(self, node, extras): # Callback when command is spoken.
|
||||||
javaBootstrap.disable()
|
javaBootstrap.disable()
|
||||||
javaGrammar.enable()
|
javaGrammar.enable()
|
||||||
print "Java grammar enabled"
|
print ("Java grammar enabled")
|
||||||
|
|
||||||
class JavaDisabler(CompoundRule):
|
class JavaDisabler(CompoundRule):
|
||||||
spec = "switch language" # Spoken form of command.
|
spec = "switch language" # Spoken form of command.
|
||||||
|
|
||||||
def _process_recognition(self, node, extras): # Callback when command is spoken.
|
def _process_recognition(self, node, extras): # Callback when command is spoken.
|
||||||
javaGrammar.disable()
|
javaGrammar.disable()
|
||||||
javaBootstrap.enable()
|
javaBootstrap.enable()
|
||||||
print "Java grammar disabled"
|
print ("Java grammar disabled")
|
||||||
|
|
||||||
# This is a test rule to see if the Java grammar is enabled
|
# This is a test rule to see if the Java grammar is enabled
|
||||||
class JavaTestRule(CompoundRule):
|
class JavaTestRule(CompoundRule):
|
||||||
spec = "test Java" # Spoken form of command.
|
spec = "test Java" # Spoken form of command.
|
||||||
|
|
||||||
def _process_recognition(self, node, extras): # Callback when command is spoken.
|
def _process_recognition(self, node, extras): # Callback when command is spoken.
|
||||||
print "Java grammar tested"
|
print ("Java grammar tested")
|
||||||
|
|
||||||
# Handles Java commenting syntax
|
# Handles Java commenting syntax
|
||||||
class JavaCommentsSyntax(MappingRule):
|
class JavaCommentsSyntax(MappingRule):
|
||||||
|
@ -32,7 +32,7 @@ class JavaCommentsSyntax(MappingRule):
|
||||||
mapping = {
|
mapping = {
|
||||||
"comment": Text("// "),
|
"comment": Text("// "),
|
||||||
"multiline comment": Text("/*") + Key("enter") #+ Key("enter") + Text("*/") + Key("up")
|
"multiline comment": Text("/*") + Key("enter") #+ Key("enter") + Text("*/") + Key("up")
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Deals with printing Java datatypes
|
# Deals with printing Java datatypes
|
||||||
|
@ -58,7 +58,7 @@ class JavaComparisonOperators(MappingRule):
|
||||||
"less than": Text("<"),
|
"less than": Text("<"),
|
||||||
"less than or equal to": Text("<="),
|
"less than or equal to": Text("<="),
|
||||||
"greater than or equal to": Text(">="),
|
"greater than or equal to": Text(">="),
|
||||||
|
|
||||||
}
|
}
|
||||||
# This rule deals with the Java Boolean operators
|
# This rule deals with the Java Boolean operators
|
||||||
class JavaBooleanOperators(MappingRule):
|
class JavaBooleanOperators(MappingRule):
|
||||||
|
@ -69,9 +69,9 @@ class JavaBooleanOperators(MappingRule):
|
||||||
"true": Text("true"),
|
"true": Text("true"),
|
||||||
"false": Text("false"),
|
"false": Text("false"),
|
||||||
"not": Text("!")
|
"not": Text("!")
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class JavaControlStructures(MappingRule):
|
class JavaControlStructures(MappingRule):
|
||||||
#note: the last curly braces were commented out so that these commands properly work with the auto formatting of the eclipse IDE.
|
#note: the last curly braces were commented out so that these commands properly work with the auto formatting of the eclipse IDE.
|
||||||
|
@ -89,14 +89,14 @@ class JavaControlStructures(MappingRule):
|
||||||
"interface": Text("<access modifier> interface InterfaceName {") + Key("enter")+ Key("enter"), #+ Text("}"),
|
"interface": Text("<access modifier> interface InterfaceName {") + Key("enter")+ Key("enter"), #+ Text("}"),
|
||||||
"enumeration": Text("<access modifier> enum EnumName {") + Key("enter")+ Key("enter"), #+ Text("}")
|
"enumeration": Text("<access modifier> enum EnumName {") + Key("enter")+ Key("enter"), #+ Text("}")
|
||||||
"method": Text("<datatype> methodName() {") + Key("enter")+ Key("enter"), #+ Text("}"),
|
"method": Text("<datatype> methodName() {") + Key("enter")+ Key("enter"), #+ Text("}"),
|
||||||
|
|
||||||
}
|
}
|
||||||
# This rule provides some useful method calls in Java
|
# This rule provides some useful method calls in Java
|
||||||
class JavaUsefulMethods(MappingRule):
|
class JavaUsefulMethods(MappingRule):
|
||||||
|
|
||||||
mapping = {
|
mapping = {
|
||||||
"print statement": Text("System.out.println()") + Key("left")
|
"print statement": Text("System.out.println()") + Key("left")
|
||||||
|
|
||||||
}
|
}
|
||||||
# This rule deals with some of the Java arithmetic operators
|
# This rule deals with some of the Java arithmetic operators
|
||||||
class JavaArithmeticOperators(MappingRule):
|
class JavaArithmeticOperators(MappingRule):
|
||||||
|
@ -109,7 +109,7 @@ class JavaArithmeticOperators(MappingRule):
|
||||||
"minus": Text("-"),
|
"minus": Text("-"),
|
||||||
"divided by": Text("/"),
|
"divided by": Text("/"),
|
||||||
"modulus": Text("%") #causes some weird problem in dragonfly so this doesn't work, use "percent sign" instead
|
"modulus": Text("%") #causes some weird problem in dragonfly so this doesn't work, use "percent sign" instead
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class JavaAssignmentOperators(MappingRule):
|
class JavaAssignmentOperators(MappingRule):
|
||||||
|
@ -119,9 +119,9 @@ class JavaAssignmentOperators(MappingRule):
|
||||||
"minus equals": Text("-="),
|
"minus equals": Text("-="),
|
||||||
"multiply equals": Text("*="),
|
"multiply equals": Text("*="),
|
||||||
"divide equals": Text("/="),
|
"divide equals": Text("/="),
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class JavaMiscellaneousStuff(MappingRule):
|
class JavaMiscellaneousStuff(MappingRule):
|
||||||
|
|
||||||
|
@ -129,7 +129,7 @@ class JavaMiscellaneousStuff(MappingRule):
|
||||||
"equals": Text(" = "),
|
"equals": Text(" = "),
|
||||||
"import": Text("import ;") + Key("left"),
|
"import": Text("import ;") + Key("left"),
|
||||||
"new": Text("new "),
|
"new": Text("new "),
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class JavaAccessModifiers(MappingRule):
|
class JavaAccessModifiers(MappingRule):
|
||||||
|
@ -138,7 +138,7 @@ class JavaAccessModifiers(MappingRule):
|
||||||
"public": Text("public "),
|
"public": Text("public "),
|
||||||
"private": Text("private "),
|
"private": Text("private "),
|
||||||
"protected": Text("protected ")
|
"protected": Text("protected ")
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class JavaEscapeSequences(MappingRule):
|
class JavaEscapeSequences(MappingRule):
|
||||||
|
@ -147,12 +147,12 @@ class JavaEscapeSequences(MappingRule):
|
||||||
"escape quotes": Text("\ ")+ Key("left") + Text("\"") + Text("\ ")+ Key("left") + Text("\""),
|
"escape quotes": Text("\ ")+ Key("left") + Text("\"") + Text("\ ")+ Key("left") + Text("\""),
|
||||||
"escape single quotes": Text("\ ")+ Key("left") + Text("\'") + Text("\ ")+ Key("left") + Text("\'"),
|
"escape single quotes": Text("\ ")+ Key("left") + Text("\'") + Text("\ ")+ Key("left") + Text("\'"),
|
||||||
"escape line": Text("\ ")+ Key("left") + Text("n"),
|
"escape line": Text("\ ")+ Key("left") + Text("n"),
|
||||||
"escape tab": Text("\ ")+ Key("left") + Text("t"),
|
"escape tab": Text("\ ")+ Key("left") + Text("t"),
|
||||||
"escape carriage return": Text("\ ")+ Key("left") + Text("r"),
|
"escape carriage return": Text("\ ")+ Key("left") + Text("r"),
|
||||||
}
|
}
|
||||||
|
|
||||||
# The main Java grammar rules are activated here
|
# The main Java grammar rules are activated here
|
||||||
javaBootstrap = Grammar("java bootstrap")
|
javaBootstrap = Grammar("java bootstrap")
|
||||||
javaBootstrap.add_rule(JavaEnabler())
|
javaBootstrap.add_rule(JavaEnabler())
|
||||||
javaBootstrap.load()
|
javaBootstrap.load()
|
||||||
|
|
||||||
|
@ -178,4 +178,4 @@ javaGrammar.disable()
|
||||||
def unload():
|
def unload():
|
||||||
global javaGrammar
|
global javaGrammar
|
||||||
if javaGrammar: javaGrammar.unload()
|
if javaGrammar: javaGrammar.unload()
|
||||||
javaGrammar = None
|
javaGrammar = None
|
||||||
|
|
|
@ -16,7 +16,7 @@ class JavaScriptEnabler(CompoundRule):
|
||||||
JavaScriptBootstrap.disable()
|
JavaScriptBootstrap.disable()
|
||||||
JavaScriptGrammar.enable()
|
JavaScriptGrammar.enable()
|
||||||
s = "JavaScript grammar activated"
|
s = "JavaScript grammar activated"
|
||||||
print s
|
print (s)
|
||||||
speaker.Speak(s)
|
speaker.Speak(s)
|
||||||
|
|
||||||
|
|
||||||
|
@ -27,14 +27,14 @@ class JavaScriptDisabler(CompoundRule):
|
||||||
JavaScriptGrammar.disable()
|
JavaScriptGrammar.disable()
|
||||||
JavaScriptBootstrap.enable()
|
JavaScriptBootstrap.enable()
|
||||||
s = "JavaScript grammar deactivated"
|
s = "JavaScript grammar deactivated"
|
||||||
print s
|
print (s)
|
||||||
speaker.Speak(s)
|
speaker.Speak(s)
|
||||||
|
|
||||||
class JavaScriptTestRule(CompoundRule):
|
class JavaScriptTestRule(CompoundRule):
|
||||||
spec = "test JavaScript" # Spoken form of command.
|
spec = "test JavaScript" # Spoken form of command.
|
||||||
|
|
||||||
def _process_recognition(self, node, extras): # Callback when command is spoken.
|
def _process_recognition(self, node, extras): # Callback when command is spoken.
|
||||||
print "JavaScript grammar tested"
|
print ("JavaScript grammar tested")
|
||||||
|
|
||||||
class JavaScriptControlStructures(MappingRule):
|
class JavaScriptControlStructures(MappingRule):
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
# This script is to be used for programming in the Julia programming language
|
# This script is to be used for programming in the Julia programming language
|
||||||
|
|
||||||
from dragonfly import (Grammar, CompoundRule, Dictation, Text, Key, AppContext, MappingRule)
|
from dragonfly import (Grammar, CompoundRule, Dictation, Text, Key, AppContext, MappingRule)
|
||||||
|
import win32com.client
|
||||||
|
speaker = win32com.client.Dispatch("SAPI.SpVoice")
|
||||||
|
|
||||||
class JuliaEnabler(CompoundRule):
|
class JuliaEnabler(CompoundRule):
|
||||||
spec = "Enable Julia" # Spoken command to enable the Julia grammar.
|
spec = "Enable Julia" # Spoken command to enable the Julia grammar.
|
||||||
|
@ -9,7 +11,9 @@ class JuliaEnabler(CompoundRule):
|
||||||
def _process_recognition(self, node, extras): # Callback when command is spoken.
|
def _process_recognition(self, node, extras): # Callback when command is spoken.
|
||||||
JuliaBootstrap.disable()
|
JuliaBootstrap.disable()
|
||||||
JuliaGrammar.enable()
|
JuliaGrammar.enable()
|
||||||
print "Julia grammar enabled"
|
s = "Julia grammar enabled"
|
||||||
|
print (s)
|
||||||
|
speaker.Speak(s)
|
||||||
|
|
||||||
class JuliaDisabler(CompoundRule):
|
class JuliaDisabler(CompoundRule):
|
||||||
spec = "switch language" # spoken command to disable the Julia grammar.
|
spec = "switch language" # spoken command to disable the Julia grammar.
|
||||||
|
@ -17,22 +21,23 @@ class JuliaDisabler(CompoundRule):
|
||||||
def _process_recognition(self, node, extras): # Callback when command is spoken.
|
def _process_recognition(self, node, extras): # Callback when command is spoken.
|
||||||
JuliaGrammar.disable()
|
JuliaGrammar.disable()
|
||||||
JuliaBootstrap.enable()
|
JuliaBootstrap.enable()
|
||||||
print "Julia grammar disabled"
|
s = "Julia grammar disabled"
|
||||||
|
print (s)
|
||||||
|
speaker.Speak(s)
|
||||||
|
|
||||||
|
|
||||||
# This is a test rule to see if the Julia grammar is enabled
|
# This is a test rule to see if the Julia grammar is enabled
|
||||||
class JuliaTestRule(CompoundRule):
|
class JuliaTestRule(CompoundRule):
|
||||||
spec = "test Julia" # Spoken form of command.
|
spec = "test Julia" # Spoken form of command.
|
||||||
|
|
||||||
def _process_recognition(self, node, extras): # Callback when command is spoken.
|
def _process_recognition(self, node, extras): # Callback when command is spoken.
|
||||||
print "Julia grammar tested"
|
print ("Julia grammar tested")
|
||||||
|
|
||||||
# Handles Julia commenting syntax
|
# Handles Julia commenting syntax
|
||||||
class JuliaCommentsSyntax(MappingRule):
|
class JuliaCommentsSyntax(MappingRule):
|
||||||
|
|
||||||
mapping = {
|
mapping = {
|
||||||
"comment": Text("# "),
|
"comment": Text("# "),
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -42,11 +47,8 @@ class JuliaControlStructures(MappingRule):
|
||||||
"if": Text("if condition:") + Key("enter"),
|
"if": Text("if condition:") + Key("enter"),
|
||||||
"while loop": Text("while condition:") + Key("enter"),
|
"while loop": Text("while condition:") + Key("enter"),
|
||||||
"for loop": Text("for something in something:") + Key("enter"),
|
"for loop": Text("for something in something:") + Key("enter"),
|
||||||
|
|
||||||
"function": Text("function functionName()") + Key("enter") + Key("enter") + Text("end"),
|
"function": Text("function functionName()") + Key("enter") + Key("enter") + Text("end"),
|
||||||
"class": Text("class className(inheritance):") + Key("enter"),
|
"class": Text("class className(inheritance):") + Key("enter"),
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -8,17 +8,17 @@
|
||||||
Command-module for cursor movement and **editing**
|
Command-module for cursor movement and **editing**
|
||||||
============================================================================
|
============================================================================
|
||||||
|
|
||||||
This module allows the user to control the cursor and
|
This module allows the user to control the cursor and
|
||||||
efficiently perform multiple text editing actions within a
|
efficiently perform multiple text editing actions within a
|
||||||
single phrase.
|
single phrase.
|
||||||
|
|
||||||
|
|
||||||
Example commands
|
Example commands
|
||||||
----------------------------------------------------------------------------
|
----------------------------------------------------------------------------
|
||||||
|
|
||||||
*Note the "/" characters in the examples below are simply
|
*Note the "/" characters in the examples below are simply
|
||||||
to help the reader see the different parts of each voice
|
to help the reader see the different parts of each voice
|
||||||
command. They are not present in the actual command and
|
command. They are not present in the actual command and
|
||||||
should not be spoken.*
|
should not be spoken.*
|
||||||
|
|
||||||
Example: **"up 4 / down 1 page / home / space 2"**
|
Example: **"up 4 / down 1 page / home / space 2"**
|
||||||
|
@ -31,43 +31,38 @@ Example: **"left 7 words / backspace 3 / insert hello Cap world"**
|
||||||
the text "hello World".
|
the text "hello World".
|
||||||
|
|
||||||
Example: **"home / space 4 / down / 43 times"**
|
Example: **"home / space 4 / down / 43 times"**
|
||||||
This command will insert 4 spaces at the beginning of
|
This command will insert 4 spaces at the beginning of
|
||||||
of this and the next 42 lines. The final "43 times"
|
of this and the next 42 lines. The final "43 times"
|
||||||
repeats everything in front of it that many times.
|
repeats everything in front of it that many times.
|
||||||
|
|
||||||
|
|
||||||
Discussion of this module
|
Discussion of this module
|
||||||
----------------------------------------------------------------------------
|
----------------------------------------------------------------------------
|
||||||
|
|
||||||
This command-module creates a powerful voice command for
|
This command-module creates a powerful voice command for
|
||||||
editing and cursor movement. This command's structure can
|
editing and cursor movement. This command's structure can
|
||||||
be represented by the following simplified language model:
|
be represented by the following simplified language model:
|
||||||
|
|
||||||
- *CommandRule* -- top-level rule which the user can say
|
- *CommandRule* -- top-level rule which the user can say
|
||||||
- *repetition* -- sequence of actions (name = "sequence")
|
- *repetition* -- sequence of actions (name = "sequence")
|
||||||
- *KeystrokeRule* -- rule that maps a single
|
- *KeystrokeRule* -- rule that maps a single
|
||||||
spoken-form to an action
|
spoken-form to an action
|
||||||
- *optional* -- optional specification of repeat count
|
- *optional* -- optional specification of repeat count
|
||||||
- *integer* -- repeat count (name = "n")
|
- *integer* -- repeat count (name = "n")
|
||||||
- *literal* -- "times"
|
- *literal* -- "times"
|
||||||
|
|
||||||
The top-level command rule has a callback method which is
|
The top-level command rule has a callback method which is
|
||||||
called when this voice command is recognized. The logic
|
called when this voice command is recognized. The logic
|
||||||
within this callback is very simple:
|
within this callback is very simple:
|
||||||
|
|
||||||
1. Retrieve the sequence of actions from the element with
|
1. Retrieve the sequence of actions from the element with
|
||||||
the name "sequence".
|
the name "sequence".
|
||||||
2. Retrieve the repeat count from the element with the name
|
2. Retrieve the repeat count from the element with the name
|
||||||
"n".
|
"n".
|
||||||
3. Execute the actions the specified number of times.
|
3. Execute the actions the specified number of times.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
try:
|
|
||||||
import pkg_resources
|
|
||||||
pkg_resources.require("dragonfly >= 0.6.5beta1.dev-r99")
|
|
||||||
except ImportError:
|
|
||||||
pass
|
|
||||||
|
|
||||||
from dragonfly import *
|
from dragonfly import *
|
||||||
|
|
||||||
|
@ -177,12 +172,12 @@ else:
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
# Here we define the keystroke rule.
|
# Here we define the keystroke rule.
|
||||||
|
|
||||||
# This rule maps spoken-forms to actions. Some of these
|
# This rule maps spoken-forms to actions. Some of these
|
||||||
# include special elements like the number with name "n"
|
# include special elements like the number with name "n"
|
||||||
# or the dictation with name "text". This rule is not
|
# or the dictation with name "text". This rule is not
|
||||||
# exported, but is referenced by other elements later on.
|
# exported, but is referenced by other elements later on.
|
||||||
# It is derived from MappingRule, so that its "value" when
|
# It is derived from MappingRule, so that its "value" when
|
||||||
# processing a recognition will be the right side of the
|
# processing a recognition will be the right side of the
|
||||||
# mapping: an action.
|
# mapping: an action.
|
||||||
# Note that this rule does not execute these actions, it
|
# Note that this rule does not execute these actions, it
|
||||||
# simply returns them when it's value() method is called.
|
# simply returns them when it's value() method is called.
|
||||||
|
@ -202,10 +197,10 @@ class KeystrokeRule(MappingRule):
|
||||||
defaults = {
|
defaults = {
|
||||||
"n": 1,
|
"n": 1,
|
||||||
}
|
}
|
||||||
# Note: when processing a recognition, the *value* of
|
# Note: when processing a recognition, the *value* of
|
||||||
# this rule will be an action object from the right side
|
# this rule will be an action object from the right side
|
||||||
# of the mapping given above. This is default behavior
|
# of the mapping given above. This is default behavior
|
||||||
# of the MappingRule class' value() method. It also
|
# of the MappingRule class' value() method. It also
|
||||||
# substitutes any "%(...)." within the action spec
|
# substitutes any "%(...)." within the action spec
|
||||||
# with the appropriate spoken values.
|
# with the appropriate spoken values.
|
||||||
|
|
||||||
|
@ -236,10 +231,10 @@ sequence = Repetition(single_action, min=1, max=16, name="sequence")
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
# Here we define the top-level rule which the user can say.
|
# Here we define the top-level rule which the user can say.
|
||||||
|
|
||||||
# This is the rule that actually handles recognitions.
|
# This is the rule that actually handles recognitions.
|
||||||
# When a recognition occurs, it's _process_recognition()
|
# When a recognition occurs, it's _process_recognition()
|
||||||
# method will be called. It receives information about the
|
# method will be called. It receives information about the
|
||||||
# recognition in the "extras" argument: the sequence of
|
# recognition in the "extras" argument: the sequence of
|
||||||
# actions and the number of times to repeat them.
|
# actions and the number of times to repeat them.
|
||||||
class RepeatRule(CompoundRule):
|
class RepeatRule(CompoundRule):
|
||||||
|
|
||||||
|
|
|
@ -6,26 +6,26 @@ from dragonfly import (Grammar, CompoundRule, Dictation, Text, Key, AppContext,
|
||||||
|
|
||||||
class PHPEnabler(CompoundRule):
|
class PHPEnabler(CompoundRule):
|
||||||
spec = "Enable PHP" # Spoken form of command.
|
spec = "Enable PHP" # Spoken form of command.
|
||||||
|
|
||||||
def _process_recognition(self, node, extras): # Callback when command is spoken.
|
def _process_recognition(self, node, extras): # Callback when command is spoken.
|
||||||
phpBootstrap.disable()
|
phpBootstrap.disable()
|
||||||
phpGrammar.enable()
|
phpGrammar.enable()
|
||||||
print "PHP grammar enabled"
|
print ("PHP grammar enabled")
|
||||||
|
|
||||||
class PHPDisabler(CompoundRule):
|
class PHPDisabler(CompoundRule):
|
||||||
spec = "switch language" # Spoken form of command.
|
spec = "switch language" # Spoken form of command.
|
||||||
|
|
||||||
def _process_recognition(self, node, extras): # Callback when command is spoken.
|
def _process_recognition(self, node, extras): # Callback when command is spoken.
|
||||||
phpGrammar.disable()
|
phpGrammar.disable()
|
||||||
phpBootstrap.enable()
|
phpBootstrap.enable()
|
||||||
print "PHP grammar disabled"
|
print ("PHP grammar disabled")
|
||||||
|
|
||||||
|
|
||||||
class PHPTestRule(CompoundRule):
|
class PHPTestRule(CompoundRule):
|
||||||
spec = "test PHP" # Spoken form of command.
|
spec = "test PHP" # Spoken form of command.
|
||||||
|
|
||||||
def _process_recognition(self, node, extras): # Callback when command is spoken.
|
def _process_recognition(self, node, extras): # Callback when command is spoken.
|
||||||
print "PHP grammar tested"
|
print ("PHP grammar tested")
|
||||||
|
|
||||||
# Deals with printing PHP datatypes
|
# Deals with printing PHP datatypes
|
||||||
class PHPDataTypes(MappingRule):
|
class PHPDataTypes(MappingRule):
|
||||||
|
@ -43,7 +43,7 @@ class PHPVariableDeclarations(MappingRule):
|
||||||
|
|
||||||
mapping = {
|
mapping = {
|
||||||
"variable": Text("$")
|
"variable": Text("$")
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Handles PHP commenting syntax
|
# Handles PHP commenting syntax
|
||||||
|
@ -52,7 +52,7 @@ class PHPCommentsSyntax(MappingRule):
|
||||||
mapping = {
|
mapping = {
|
||||||
"comment": Text("// "),
|
"comment": Text("// "),
|
||||||
"multiline comment": Text("/*") + Key("enter") + Key("enter") + Text("*/") + Key("up")
|
"multiline comment": Text("/*") + Key("enter") + Key("enter") + Text("*/") + Key("up")
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class PHPSuperGlobals(MappingRule):
|
class PHPSuperGlobals(MappingRule):
|
||||||
|
@ -83,8 +83,8 @@ class PHPControlStructures(MappingRule):
|
||||||
"try catch": Text("try {") + Key("enter")+ Key("enter") + Text("}") + Key("enter") + Text("catch(<ExceptionClass> e) {") + Key("enter")+ Key("enter") + Text("}"),
|
"try catch": Text("try {") + Key("enter")+ Key("enter") + Text("}") + Key("enter") + Text("catch(<ExceptionClass> e) {") + Key("enter")+ Key("enter") + Text("}"),
|
||||||
"function": Text("function functionName() {") + Key("enter")+ Key("enter") + Text("}"),
|
"function": Text("function functionName() {") + Key("enter")+ Key("enter") + Text("}"),
|
||||||
"class": Text("class ClassName {") + Key("enter")+ Key("enter") + Text("}")
|
"class": Text("class ClassName {") + Key("enter")+ Key("enter") + Text("}")
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class PHPAccessModifiers(MappingRule):
|
class PHPAccessModifiers(MappingRule):
|
||||||
|
|
||||||
|
@ -92,14 +92,14 @@ class PHPAccessModifiers(MappingRule):
|
||||||
"public": Text("public "),
|
"public": Text("public "),
|
||||||
"private": Text("private "),
|
"private": Text("private "),
|
||||||
"static": Text("static ")
|
"static": Text("static ")
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class PHPUsefulMethods(MappingRule):
|
class PHPUsefulMethods(MappingRule):
|
||||||
|
|
||||||
mapping = {
|
mapping = {
|
||||||
"print statement": Text("echo \"\"") + Key("left")
|
"print statement": Text("echo \"\"") + Key("left")
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class PHPLogicalOperators(MappingRule):
|
class PHPLogicalOperators(MappingRule):
|
||||||
|
@ -109,7 +109,7 @@ class PHPLogicalOperators(MappingRule):
|
||||||
"logical or": Text("||"),
|
"logical or": Text("||"),
|
||||||
"true": Text("true"),
|
"true": Text("true"),
|
||||||
"false": Text("false"),
|
"false": Text("false"),
|
||||||
"not": Text("!"),
|
"not": Text("!"),
|
||||||
"logical exclusive or": Text("xor")
|
"logical exclusive or": Text("xor")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -121,7 +121,7 @@ class PHPAssignmentOperators(MappingRule):
|
||||||
"multiply equals": Text("*="),
|
"multiply equals": Text("*="),
|
||||||
"divide equals": Text("/="),
|
"divide equals": Text("/="),
|
||||||
".equals": Text(".=")
|
".equals": Text(".=")
|
||||||
}
|
}
|
||||||
|
|
||||||
class PHPArithmeticOperators(MappingRule):
|
class PHPArithmeticOperators(MappingRule):
|
||||||
|
|
||||||
|
@ -140,7 +140,7 @@ class PHPEscapeSequences(MappingRule):
|
||||||
"escape quotes": Text("\ ")+ Key("left") + Text("\"") + Text("\ ")+ Key("left") + Text("\""),
|
"escape quotes": Text("\ ")+ Key("left") + Text("\"") + Text("\ ")+ Key("left") + Text("\""),
|
||||||
"escape single quotes": Text("\ ")+ Key("left") + Text("\'") + Text("\ ")+ Key("left") + Text("\'"),
|
"escape single quotes": Text("\ ")+ Key("left") + Text("\'") + Text("\ ")+ Key("left") + Text("\'"),
|
||||||
"escape line": Text("\ ")+ Key("left") + Text("n"),
|
"escape line": Text("\ ")+ Key("left") + Text("n"),
|
||||||
"escape tab": Text("\ ")+ Key("left") + Text("t"),
|
"escape tab": Text("\ ")+ Key("left") + Text("t"),
|
||||||
"escape carriage return": Text("\ ")+ Key("left") + Text("r"),
|
"escape carriage return": Text("\ ")+ Key("left") + Text("r"),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -155,22 +155,22 @@ class PHPComparisonOperators(MappingRule):
|
||||||
"less than": Text("<"),
|
"less than": Text("<"),
|
||||||
"less than or equal to": Text("<="),
|
"less than or equal to": Text("<="),
|
||||||
"greater than or equal to": Text(">="),
|
"greater than or equal to": Text(">="),
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class PHPMiscellaneousStuff(MappingRule):
|
class PHPMiscellaneousStuff(MappingRule):
|
||||||
|
|
||||||
mapping = {
|
mapping = {
|
||||||
"PHP block": Text("<?php ?>"),
|
"PHP block": Text("<?php ?>"),
|
||||||
|
|
||||||
|
|
||||||
"require": Text("require ('');"),
|
"require": Text("require ('');"),
|
||||||
"require once": Text("require_once ('');"),
|
"require once": Text("require_once ('');"),
|
||||||
"include": Text("include ('');"),
|
"include": Text("include ('');"),
|
||||||
"include once": Text("require_once ('');"),
|
"include once": Text("require_once ('');"),
|
||||||
"equals": Text(" = "),
|
"equals": Text(" = "),
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
phpBootstrap = Grammar("php bootstrap") # Create a grammar to contain the command rule.
|
phpBootstrap = Grammar("php bootstrap") # Create a grammar to contain the command rule.
|
||||||
phpBootstrap.add_rule(PHPEnabler())
|
phpBootstrap.add_rule(PHPEnabler())
|
||||||
|
@ -200,4 +200,4 @@ phpGrammar.disable()
|
||||||
def unload():
|
def unload():
|
||||||
global phpGrammar
|
global phpGrammar
|
||||||
if phpGrammar: phpGrammar.unload()
|
if phpGrammar: phpGrammar.unload()
|
||||||
phpGrammar = None
|
phpGrammar = None
|
||||||
|
|
|
@ -2,37 +2,41 @@
|
||||||
# This script is to be used for programming in the Python programming language
|
# This script is to be used for programming in the Python programming language
|
||||||
|
|
||||||
from dragonfly import (Grammar, CompoundRule, Dictation, Text, Key, AppContext, MappingRule)
|
from dragonfly import (Grammar, CompoundRule, Dictation, Text, Key, AppContext, MappingRule)
|
||||||
|
import win32com.client
|
||||||
|
speaker = win32com.client.Dispatch("SAPI.SpVoice")
|
||||||
class PythonEnabler(CompoundRule):
|
class PythonEnabler(CompoundRule):
|
||||||
spec = "Enable Python" # Spoken command to enable the Python grammar.
|
spec = "Enable Python" # Spoken command to enable the Python grammar.
|
||||||
|
|
||||||
def _process_recognition(self, node, extras): # Callback when command is spoken.
|
def _process_recognition(self, node, extras): # Callback when command is spoken.
|
||||||
pythonBootstrap.disable()
|
pythonBootstrap.disable()
|
||||||
pythonGrammar.enable()
|
pythonGrammar.enable()
|
||||||
print "Python grammar enabled"
|
print ("Python grammar enabled")
|
||||||
|
s = "Python grammar enabled"
|
||||||
|
print (s)
|
||||||
|
speaker.Speak(s)
|
||||||
|
|
||||||
class PythonDisabler(CompoundRule):
|
class PythonDisabler(CompoundRule):
|
||||||
spec = "switch language" # spoken command to disable the Python grammar.
|
spec = "switch language" # spoken command to disable the Python grammar.
|
||||||
|
|
||||||
def _process_recognition(self, node, extras): # Callback when command is spoken.
|
def _process_recognition(self, node, extras): # Callback when command is spoken.
|
||||||
pythonGrammar.disable()
|
pythonGrammar.disable()
|
||||||
pythonBootstrap.enable()
|
pythonBootstrap.enable()
|
||||||
print "Python grammar disabled"
|
print ("Python grammar disabled")
|
||||||
|
|
||||||
# This is a test rule to see if the Python grammar is enabled
|
# This is a test rule to see if the Python grammar is enabled
|
||||||
class PythonTestRule(CompoundRule):
|
class PythonTestRule(CompoundRule):
|
||||||
spec = "test Python" # Spoken form of command.
|
spec = "test Python" # Spoken form of command.
|
||||||
|
|
||||||
def _process_recognition(self, node, extras): # Callback when command is spoken.
|
def _process_recognition(self, node, extras): # Callback when command is spoken.
|
||||||
print "Python grammar tested"
|
print ("Python grammar tested")
|
||||||
|
|
||||||
# Handles Python commenting syntax
|
# Handles Python commenting syntax
|
||||||
class PythonCommentsSyntax(MappingRule):
|
class PythonCommentsSyntax(MappingRule):
|
||||||
|
|
||||||
mapping = {
|
mapping = {
|
||||||
"comment": Text("# "),
|
"comment": Text("# "),
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -42,16 +46,16 @@ class PythonControlStructures(MappingRule):
|
||||||
"if": Text("if condition:") + Key("enter"),
|
"if": Text("if condition:") + Key("enter"),
|
||||||
"while loop": Text("while condition:") + Key("enter"),
|
"while loop": Text("while condition:") + Key("enter"),
|
||||||
"for loop": Text("for something in something:") + Key("enter"),
|
"for loop": Text("for something in something:") + Key("enter"),
|
||||||
|
|
||||||
"function": Text("def functionName():") + Key("enter"),
|
"function": Text("def functionName():") + Key("enter"),
|
||||||
"class": Text("class className(inheritance):") + Key("enter"),
|
"class": Text("class className(inheritance):") + Key("enter"),
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# The main Python grammar rules are activated here
|
# The main Python grammar rules are activated here
|
||||||
pythonBootstrap = Grammar("python bootstrap")
|
pythonBootstrap = Grammar("python bootstrap")
|
||||||
pythonBootstrap.add_rule(PythonEnabler())
|
pythonBootstrap.add_rule(PythonEnabler())
|
||||||
pythonBootstrap.load()
|
pythonBootstrap.load()
|
||||||
|
|
||||||
|
@ -68,4 +72,4 @@ pythonGrammar.disable()
|
||||||
def unload():
|
def unload():
|
||||||
global pythonGrammar
|
global pythonGrammar
|
||||||
if pythonGrammar: pythonGrammar.unload()
|
if pythonGrammar: pythonGrammar.unload()
|
||||||
pythonGrammar = None
|
pythonGrammar = None
|
||||||
|
|
|
@ -13,7 +13,7 @@ class TerminalEnabler(CompoundRule):
|
||||||
TerminalBootstrap.disable()
|
TerminalBootstrap.disable()
|
||||||
TerminalGrammar.enable()
|
TerminalGrammar.enable()
|
||||||
s = "Terminal grammar activated"
|
s = "Terminal grammar activated"
|
||||||
print s
|
print (s)
|
||||||
speaker.Speak(s)
|
speaker.Speak(s)
|
||||||
class TerminalDisabler(CompoundRule):
|
class TerminalDisabler(CompoundRule):
|
||||||
spec = "switch language" # Spoken form of command.
|
spec = "switch language" # Spoken form of command.
|
||||||
|
@ -22,14 +22,14 @@ class TerminalDisabler(CompoundRule):
|
||||||
TerminalGrammar.disable()
|
TerminalGrammar.disable()
|
||||||
TerminalBootstrap.enable()
|
TerminalBootstrap.enable()
|
||||||
s = "Terminal grammar deactivated"
|
s = "Terminal grammar deactivated"
|
||||||
print s
|
print (s)
|
||||||
speaker.Speak(s)
|
speaker.Speak(s)
|
||||||
|
|
||||||
class TerminalTestRule(CompoundRule):
|
class TerminalTestRule(CompoundRule):
|
||||||
spec = "test Terminal" # Spoken form of command.
|
spec = "test Terminal" # Spoken form of command.
|
||||||
|
|
||||||
def _process_recognition(self, node, extras): # Callback when command is spoken.
|
def _process_recognition(self, node, extras): # Callback when command is spoken.
|
||||||
print "Terminal grammar tested"
|
print ("Terminal grammar tested")
|
||||||
|
|
||||||
|
|
||||||
class TerminalTags(MappingRule):
|
class TerminalTags(MappingRule):
|
||||||
|
|
|
@ -16,7 +16,7 @@ class VueEnabler(CompoundRule):
|
||||||
VueBootstrap.disable()
|
VueBootstrap.disable()
|
||||||
VueGrammar.enable()
|
VueGrammar.enable()
|
||||||
s = "Vue JS grammar activated"
|
s = "Vue JS grammar activated"
|
||||||
print s
|
print (s)
|
||||||
speaker.Speak(s)
|
speaker.Speak(s)
|
||||||
|
|
||||||
class VueDisabler(CompoundRule):
|
class VueDisabler(CompoundRule):
|
||||||
|
@ -26,7 +26,7 @@ class VueDisabler(CompoundRule):
|
||||||
VueGrammar.disable()
|
VueGrammar.disable()
|
||||||
VueBootstrap.enable()
|
VueBootstrap.enable()
|
||||||
s = "Vue JS grammar deactivated"
|
s = "Vue JS grammar deactivated"
|
||||||
print s
|
print (s)
|
||||||
speaker.Speak(s)
|
speaker.Speak(s)
|
||||||
|
|
||||||
class VueTestRule(CompoundRule):
|
class VueTestRule(CompoundRule):
|
||||||
|
@ -34,7 +34,7 @@ class VueTestRule(CompoundRule):
|
||||||
|
|
||||||
def _process_recognition(self, node, extras): # Callback when command is spoken.
|
def _process_recognition(self, node, extras): # Callback when command is spoken.
|
||||||
s = "Vue JS grammar tested"
|
s = "Vue JS grammar tested"
|
||||||
print s
|
print (s)
|
||||||
speaker.Speak(s)
|
speaker.Speak(s)
|
||||||
|
|
||||||
class VueControlStructures(MappingRule):
|
class VueControlStructures(MappingRule):
|
||||||
|
|
|
@ -0,0 +1,79 @@
|
||||||
|
#
|
||||||
|
# This file is a command-module for Dragonfly.
|
||||||
|
# (c) Copyright 2008 by Christo Butcher
|
||||||
|
# Licensed under the LGPL, see <http://www.gnu.org/licenses/>
|
||||||
|
#
|
||||||
|
|
||||||
|
"""
|
||||||
|
Command-module loader for WSR
|
||||||
|
=============================
|
||||||
|
|
||||||
|
This script can be used to look Dragonfly command-modules
|
||||||
|
for use with Window Speech Recognition. It scans the
|
||||||
|
directory it's in and loads any ``_*.py`` it finds.
|
||||||
|
|
||||||
|
"""
|
||||||
|
|
||||||
|
import os.path
|
||||||
|
import sys
|
||||||
|
|
||||||
|
import six
|
||||||
|
|
||||||
|
from dragonfly import get_engine
|
||||||
|
from dragonfly.loader import CommandModuleDirectory
|
||||||
|
from dragonfly.log import setup_log
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------
|
||||||
|
# Set up basic logging.
|
||||||
|
|
||||||
|
setup_log()
|
||||||
|
# logging.getLogger("compound.parse").setLevel(logging.INFO)
|
||||||
|
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------
|
||||||
|
# Main event driving loop.
|
||||||
|
|
||||||
|
def main():
|
||||||
|
try:
|
||||||
|
path = os.path.dirname(__file__)
|
||||||
|
except NameError:
|
||||||
|
# The "__file__" name is not always available, for example
|
||||||
|
# when this module is run from PythonWin. In this case we
|
||||||
|
# simply use the current working directory.
|
||||||
|
path = os.getcwd()
|
||||||
|
__file__ = os.path.join(path, "dfly-loader-wsr.py")
|
||||||
|
|
||||||
|
# Initialize and connect the engine.
|
||||||
|
# Set any configuration options here as keyword arguments.
|
||||||
|
engine = get_engine("sapi5inproc")
|
||||||
|
engine.connect()
|
||||||
|
|
||||||
|
# Load grammars.
|
||||||
|
directory = CommandModuleDirectory(path, excludes=[__file__])
|
||||||
|
directory.load()
|
||||||
|
|
||||||
|
# Define recognition callback functions.
|
||||||
|
def on_begin():
|
||||||
|
print("Speech start detected.")
|
||||||
|
|
||||||
|
def on_recognition(words):
|
||||||
|
message = u"Recognized: %s" % u" ".join(words)
|
||||||
|
|
||||||
|
# This only seems to be an issue with Python 2.7 on Windows.
|
||||||
|
if six.PY2:
|
||||||
|
encoding = sys.stdout.encoding or "ascii"
|
||||||
|
message = message.encode(encoding, errors='replace')
|
||||||
|
print(message)
|
||||||
|
|
||||||
|
def on_failure():
|
||||||
|
print("Sorry, what was that?")
|
||||||
|
|
||||||
|
# Recognize from WSR in a loop.
|
||||||
|
try:
|
||||||
|
engine.do_recognition(on_begin, on_recognition, on_failure)
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
Loading…
Reference in New Issue