Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 3
0
def test_stray():
    e = Event()
    SystemTrayExitListenerSet(e)
    stray_proc = Process(target=SystemTrayInit)
    stray_proc.start()
    time.sleep(3)
    stray_proc.terminate()
    assert True
Exemplo n.º 4
0
def initiate():
    """The top-level method to serve as the entry point of Dragonfire.

    This method is the entry point defined in `setup.py` for the `dragonfire` executable that
    placed a directory in `$PATH`.

    This method parses the command-line arguments and handles the top-level initiations accordingly.
    """

    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="REG_KEY")
    ap.add_argument("-p",
                    "--port",
                    help="Port number for server mode.",
                    default="3301",
                    metavar="PORT")
    ap.add_argument("--version",
                    help="Display the version number of Dragonfire.",
                    action="store_true")
    ap.add_argument(
        "--db",
        help=
        "Specificy the database engine for the knowledge base of learning feature. Values: 'mysql' for MySQL, 'sqlite' for SQLite. Default database engine is SQLite.",
        action="store",
        type=str)
    args = vars(ap.parse_args())
    if args["version"]:
        import pkg_resources
        print(pkg_resources.get_distribution("dragonfire").version)
        sys.exit(1)
    try:
        global dc
        userin = TextToAction(args)
        if not args["server"]:
            SystemTrayExitListenerSet(e)
            stray_proc = Process(target=SystemTrayInit)
            stray_proc.start()
            greet(userin)
        start(args, userin)
    except KeyboardInterrupt:
        if not args["server"]:
            stray_proc.terminate()
        sys.exit(1)
Exemplo n.º 5
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)