Пример #1
0
def initiate():
    ap = argparse.ArgumentParser()
    ap.add_argument(
        "-c",
        "--cli",
        help=
        "Command-line interface mode. Give commands to Dragonfire via command-line inputs (keyboard) instead of audio inputs (microphone).",
        action="store_true")
    ap.add_argument(
        "-s",
        "--silent",
        help=
        "Silent mode. Disable Text-to-Speech output. Dragonfire won't generate any audio output.",
        action="store_true")
    ap.add_argument(
        "--headless",
        help=
        "Headless mode. Do not display an avatar animation on the screen. Disable the female head model.",
        action="store_true")
    args = vars(ap.parse_args())
    global userin
    userin = TTA(args)
    try:
        global inactive
        inactive = 1
        SystemTrayExitListenerSet(e)
        stray_proc = Process(target=SystemTrayInit)
        stray_proc.start()
        dragon_greet()
        start(args)
    except KeyboardInterrupt:
        stray_proc.terminate()
        sys.exit(1)
Пример #2
0
def initiate():
    ap = argparse.ArgumentParser()
    help_msg = ("Command-line interface mode. Give commands to Dragonfire via command-line inputs (keyboard)"
                "instead of audio inputs (microphone).")
    ap.add_argument("-c", "--cli", help=help_msg, action="store_true")
    help_msg = "Silent mode. Disable Text-to-Speech output. Dragonfire won't generate any audio output."
    ap.add_argument("-s", "--silent", help=help_msg, action="store_true")
    help_msg = "Headless mode. Do not display an avatar animation on the screen. Disable the female head model."
    ap.add_argument("--headless", help=help_msg, action="store_true")
    help_msg = "Server mode. Disable any audio functionality, serve a RESTful spaCy API and become a Twitter integrated chatbot."
    ap.add_argument("--server", help=help_msg)
    args = vars(ap.parse_args())
    global userin
    userin = TTA(args)
    try:
        global inactive
        global dc
        inactive = False
        if not args["server"]:
            dc = DeepConversation()
            inactive = True
            SystemTrayExitListenerSet(e)
            stray_proc = Process(target=SystemTrayInit)
            stray_proc.start()
            dragon_greet()
        start(args)
    except KeyboardInterrupt:
        if not args["server"]:
            stray_proc.terminate()
        sys.exit(1)
Пример #3
0
import inspect
#import aiml
import contextlib
import cStringIO
from dragonfire.learn import Learn
import uuid
import string
import youtube_dl
from tinydb import TinyDB, Query
from os.path import expanduser

DRAGONFIRE_PATH = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
FNULL = open(os.devnull, 'w')
GENDER_PREFIX = {'male': 'Sir', 'female': 'My Lady'}
CONVO_ID = uuid.uuid4()
userin = TTA()
learn_ = Learn()
omniscient_ = Engine()

def command(speech):
	#here = os.path.dirname(os.path.realpath(__file__))
	#Popen(["./gradlew","web","-q"], stdout=FNULL, stderr=FNULL)
	#os.chdir(here)

	'''
	kernel = aiml.Kernel()
	with nostdout():
		with nostderr():
			kernel.learn(DRAGONFIRE_PATH + "/aiml/learn.aiml")
	'''
Пример #4
0
def initiate():
    ap = argparse.ArgumentParser()
    ap.add_argument(
        "-c",
        "--cli",
        help=
        "Command-line interface mode. Give commands to Dragonfire via command-line inputs (keyboard) instead of audio inputs (microphone).",
        action="store_true")
    ap.add_argument(
        "-s",
        "--silent",
        help=
        "Silent mode. Disable Text-to-Speech output. Dragonfire won't generate any audio output.",
        action="store_true")
    ap.add_argument(
        "-j",
        "--headless",
        help=
        "Headless mode. Do not display an avatar animation on the screen. Disable the female head model.",
        action="store_true")
    ap.add_argument("-v",
                    "--verbose",
                    help="Increase verbosity of log output.",
                    action="store_true")
    ap.add_argument(
        "-g",
        "--gspeech",
        help=
        "Instead of using the default speech recognition method(Mozilla DeepSpeech), use Google Speech Recognition service. (more accurate results)",
        action="store_true")
    ap.add_argument(
        "--server",
        help=
        "Server mode. Disable any audio functionality, serve a RESTful spaCy API and become a Twitter integrated chatbot.",
        metavar="API_KEY")
    ap.add_argument("--version",
                    help="Display the version number of Dragonfire.",
                    action="store_true")
    args = vars(ap.parse_args())
    if args["version"]:
        import pkg_resources
        print(pkg_resources.get_distribution("dragonfire").version)
        sys.exit(1)
    global userin
    userin = TTA(args)
    try:
        global inactive
        global dc
        inactive = False
        if not args["server"]:
            dc = DeepConversation()
            inactive = True
            SystemTrayExitListenerSet(e)
            stray_proc = Process(target=SystemTrayInit)
            stray_proc.start()
            dragon_greet()
        start(args)
    except KeyboardInterrupt:
        if not args["server"]:
            stray_proc.terminate()
        sys.exit(1)