From 9d5071692ceab8d09c2bfdba24f6b927ec84b7f9 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/realtime.py') 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