From 8b491e57f8a011f4f8496e44bed7eb7a4360bc93 Mon Sep 17 00:00:00 2001 From: Michael Denkowski Date: Wed, 21 Aug 2013 14:23:04 -0700 Subject: Add instances to grammar extractor --- realtime/realtime.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'realtime') diff --git a/realtime/realtime.py b/realtime/realtime.py index a6b3ed52..c42b52ab 100755 --- a/realtime/realtime.py +++ b/realtime/realtime.py @@ -30,11 +30,12 @@ class RealtimeDecoder: # Grammar extractor sa_config = os.path.join(configdir, 'sa.ini') - self.extractor = cdec.sa.GrammarExtractor(sa_config) + self.extractor = cdec.sa.GrammarExtractor(sa_config, online=True) # Decoder decoder_config = os.path.join(configdir, 'cdec.ini') decoder_weights = os.path.join(configdir, 'weights.final') + #TODO: run MIRA instead self.decoder = CdecDecoder(decoder_config, decoder_weights) def close(self): @@ -61,7 +62,11 @@ class RealtimeDecoder: return hyp def learn(self, source, target): - pass + alignment = self.aligner.align('{} ||| {}'.format(source, target)) + logging.info('Adding instance: {} ||| {} ||| {}'.format(source, target, alignment)) + self.extractor.add_instance(source, target, alignment) + # TODO: Add to LM + # TODO: MIRA update def main(): -- cgit v1.2.3