Danesprite on master
Remove broken link from the doc… (compare)
Danesprite on master
Correct errors related to Natli… (compare)
Danesprite on master
Correct errors related to Natli… (compare)
Danesprite on master
Fix a load-related error in the… Correct errors related to Natli… (compare)
Danesprite on master
Fix an error in the Optional el… (compare)
Danesprite on master
Add a workaround for a DNS erro… (compare)
Danesprite on master
Fix an encoding-related error i… Change the Natlink engine to us… (compare)
Thanks, that's good to know. If an engine back-end is to be added that uses wav2letter directly, then I'll revisit this and see what I can do. I'll give some thought to improving the solution added in #268.
There is an open issue for wav2letter engine support: #245. Although, to my knowledge, there hasn't been much activity on that recently.
@quintijn No worries :-)
It is a pity this a DNS problem, rather than a Natlink one we could fix.
is there a specific reason the decorator
module is used in dragonfly.rpc
? the usage seems equivalent to:
import functools
def _rpc_method_wrapper(method, *args, **kwargs):
...
def _rpc_method(method):
@functools.wraps(method)
def wrapper(*args, **kwargs):
return _rpc_method_wrapper(method, *args, **kwargs)
return wrapper
and switching to the above approach would make integration easier, as I ran into an issue with the decorator module
Okay then, make sense. Given that some users set logging levels using the current names, maybe this should be held off until version 1.0.0. I intend to make a few other changes like this in that release, e.g. resolving issue #238 (Modularize dependencies).
Your changes removing the decorator
dependency look good to me.
Incidentally, the requirements for dragonfly.rpc
will be made optional extras in version 1.0.0. I will probably remove the relevant import statements from dragonfly/__init__.py
.
When working with extras it would be nice in some circumstances to remember the last extra recognized for that particular spec. Let's consider the following command select word [<left_or_right>] [<n>]
The user says select word left
and then again says select word
left extra would be remembered.
Now we could set a directional default in extras. However in more complex scenarios it's not that simple. Now wrapping this up in the function would work but it really does pollute grammar sets making them harder to read. Any thoughts on implementation or should I stick to using a function?
If you do go with a function, then you can get at the underlying rule by including a _rule
argument:
def function(_rule):
print(_rule)
print(_rule._defaults["left_or_right"])
An alternative is a separate command for explicitly changing your default value for left_or_right
. This would change it for all mappings using the extra.
I think Quintijn is right here though, repeating the last action is probably easier.
again do
command is similar to what Quintijn described. This looks much more complex than it is due to utilizing Caster asynchronous actions. It could be converted utilizing to pure dragonfly. This allows to repeat not only the last command but the last utterance. Useful for CCR chains or commands with dragonfly repetition elements.# migrated this function from elsewhere for completeness of the post.
def get_and_register_history(utterances=10):
history = RecognitionHistory(utterances)
history.register()
return history
_history = get_and_register_history(10)
class Again(MappingRule):
mapping = {
"again (<n> [(times|time)] | do)":
R(Function(lambda n: Again._create_asynchronous(n)), show=False),
}
extras = [ShortIntegerRef("n", 1, 50)]
defaults = {"n": 1}
@staticmethod
def _repeat(utterance):
Playback([(utterance, 0.0)]).execute()
return False
@staticmethod
def _create_asynchronous(n):
last_utterance_index = 2
if len(_history) == 0:
return
# ContextStack adds the word to history before executing it for WSR
if get_current_engine().name in ["sapi5shared", "sapi5", "sapi5inproc"]:
if len(_history) == 1: return
# Calculatees last utterance from recognition history and creates list of str for Dragonfly Playback
utterance = list(map(str, _history[len(_history) - last_utterance_index]))
if utterance[0] == "again": return
# Create AsynchronousAction
forward = [L(S(["cancel"], lambda: Again._repeat(utterance)))]
AsynchronousAction(
forward,
rdescript="Repeat Last Action",
time_in_seconds=0.2,
repetitions=int(n),
blocking=False).execute()
MYARG=foo42 python -m dragonfly ...
set
on its own command line first would work too I think, but that sets it for multiple commands