parameters: (self, sentence, grammar=None)
return_statement: return hyp
docstring: Threadsafe, FIFO
docstring_summary: Threadsafe, FIFO
docstring_tokens: Threadsafe FIFO
function: def decode(self, sentence, grammar=None):
          '''Threadsafe, FIFO'''
          self.lock.acquire()
          input = '<seg grammar="{g}">{s}</seg>\n'.format(s=sentence, g=grammar) if grammar else '{}\n'.format(sentence)
          self.decoder.stdin.write(input)
          hyp = self.decoder.stdout.readline().strip()
          self.lock.release()
          return hyp
function_tokens: def decode ( self , sentence , grammar = None ) : self . lock . acquire ( ) input = '<seg grammar="{g}">{s}</seg>\n' . format ( s = sentence , g = grammar ) if grammar else '{}\n' . format ( sentence ) self . decoder . stdin . write ( input ) hyp = self . decoder . stdout . readline ( ) . strip ( ) self . lock . release ( ) return hyp