diff options
author | Michael Denkowski <mdenkows@cs.cmu.edu> | 2013-08-21 14:23:04 -0700 |
---|---|---|
committer | Michael Denkowski <mdenkows@cs.cmu.edu> | 2013-08-21 14:23:04 -0700 |
commit | 9d5071692ceab8d09c2bfdba24f6b927ec84b7f9 (patch) | |
tree | b3f58ff9bf9600687abd0473ee35bbde39508a91 /realtime/realtime.py | |
parent | cd666f441d91109d402e4f3993a9ec3c45306dd0 (diff) |
Add instances to grammar extractor
Diffstat (limited to 'realtime/realtime.py')
-rwxr-xr-x | realtime/realtime.py | 9 |
1 files changed, 7 insertions, 2 deletions
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(): |