def test_get_engine_nonexistent(self):
     """ Verify that getting a nonexistent engine raises an error. """
     try:
         engine = get_engine("nonexistent")
     except EngineError:
         pass  # Expected exception, so ignore.
     else:
         assert False, ("Getting a nonexistent engine should have"
                        " raised an exception, but it didn't!")
Пример #2
0
 def test_get_engine_automatic_is_usable(self):
     """ Verify that the automatically selected engine is usable. """
     engine = get_engine()
     engine.connect()
     try:
         engine.speak("testing automatic")
         from dragonfire import Literal
         from dragonfire.test import ElementTester
         tester = ElementTester(Literal("hello world"))
         results = tester.recognize("hello world")
         assert results == "hello world"
     finally:
         engine.disconnect()
Пример #3
0
 def test_get_engine_natlink_is_usable(self):
     """ Verify that the natlink engine is usable. """
     engine = get_engine("natlink")
     assert isinstance(engine, EngineBase)
     assert engine.name == "natlink"
     engine.connect()
     try:
         engine.speak("testing natlink")
         from dragonfire import Literal
         from dragonfire.test import ElementTester
         tester = ElementTester(Literal("hello world"))
         results = tester.recognize("hello world")
         assert results == "hello world"
     finally:
         engine.disconnect()
Пример #4
0
 def test_get_engine_sapi5_is_usable(self):
     """ Verify that the sapi5 engine is usable. """
     engine = get_engine("sapi5")
     assert isinstance(engine, EngineBase)
     assert engine.name == "sapi5"
     engine.connect()
     try:
         engine.speak("testing WSR")
         from dragonfire import Literal
         from dragonfire.test import ElementTester
         tester = ElementTester(Literal("hello world"), engine=engine)
         results = tester.recognize("hello world")
         assert results == "hello world", "%r != %r" % (results,
                                                        "hello world")
     finally:
         engine.disconnect()
Пример #5
0
 def setUp(self):
     self.log_capture = CapturingHandler()
     logging.getLogger("engine.timer").addHandler(self.log_capture)
     self.engine = get_engine()
Пример #6
0
 def test_get_engine_automatic(self):
     """ Verify that an engine can be selected automatically. """
     engine = get_engine()
     assert isinstance(engine, EngineBase)
Пример #7
0
 def test_get_engine_nonexistent(self):
     engine = get_engine("nonexistent")
Пример #8
0
from dragonfire.engines import get_engine

from server import Server, Status

should_load = Server.get_status() == Status.STARTING_ENGINE
if should_load:
    Server.set_status(Status.LOADING_MODULES)
    Server.set_status(Status.RUNNING)
    get_engine()


def unload():
    pass
Пример #9
0
 def value(self, node):
     from dragonfire.engines import get_engine
     return get_engine().DictationContainer(node.words())