summaryrefslogtreecommitdiff
path: root/realtime/rt/decoder.py
diff options
context:
space:
mode:
authorMichael Denkowski <mdenkows@cs.cmu.edu>2013-09-27 13:39:24 -0700
committerMichael Denkowski <mdenkows@cs.cmu.edu>2013-09-27 13:39:24 -0700
commitb8116c5c3c7e31a276ff38fc8173eab37f292364 (patch)
tree249a8a368680c177251f6b41689e5b5739ee5da8 /realtime/rt/decoder.py
parentcb718c763e07b8e1417383ef7ae5c1aca36d2a0a (diff)
Decoding and learning with multiple contexts is threadsafe and FIFO.
Diffstat (limited to 'realtime/rt/decoder.py')
-rw-r--r--realtime/rt/decoder.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/realtime/rt/decoder.py b/realtime/rt/decoder.py
index 7c36b441..da646f68 100644
--- a/realtime/rt/decoder.py
+++ b/realtime/rt/decoder.py
@@ -15,7 +15,7 @@ class Decoder:
self.lock.release()
def decode(self, sentence, grammar=None):
- '''Threadsafe'''
+ '''Threadsafe, FIFO'''
input = '<seg grammar="{g}">{s}</seg>\n'.format(s=sentence, g=grammar) if grammar else '{}\n'.format(sentence)
self.lock.acquire()
self.decoder.stdin.write(input)
@@ -45,7 +45,7 @@ class MIRADecoder(Decoder):
self.lock = util.FIFOLock()
def get_weights(self):
- '''Threadsafe'''
+ '''Threadsafe, FIFO'''
self.lock.acquire()
self.decoder.stdin.write('WEIGHTS ||| WRITE\n')
weights = self.decoder.stdout.readline().strip()
@@ -53,13 +53,13 @@ class MIRADecoder(Decoder):
return weights
def set_weights(self, w_line):
- '''Threadsafe'''
+ '''Threadsafe, FIFO'''
self.lock.acquire()
self.decoder.stdin.write('WEIGHTS ||| {}\n'.format(w_line))
self.lock.release()
def update(self, sentence, grammar, reference):
- '''Threadsafe'''
+ '''Threadsafe, FIFO'''
input = 'LEARN ||| <seg grammar="{g}">{s}</seg> ||| {r}\n'.format(s=sentence, g=grammar, r=reference)
self.lock.acquire()
self.decoder.stdin.write(input)