def run(self): logging.info('working dir is %s', self.config.experiment_dir) # get data logging.info('extracting data') Extractor(self.config).run() # learn lm logging.info('learning LM') SRILM(self.config).run_ngram_count() # train moses moses = Moses(self.config) logging.info('training TM') moses.run_train() # reweight using monolingual data if self.config.monolingual: logging.info('learning from monolingual data') NLReweighter(self.config).run() # filter disconnected rules if self.config.filter: logging.info('filtering disconnected rules') moses.filter_phrase_table() # tune moses if self.config.run == 'test': logging.info('tuning TM') moses.run_tune() if self.config.retrain: logging.info('retraining TM') moses.run_retrain() # decode input logging.info('decoding') moses.run_decode() if self.config.nlg: logging.info('running BLEU') BLEUScorer(self.config).run() pass else: # functionalize logging.info('functionalizing') Functionalizer(self.config).run() # compare answers logging.info('executing queries') if self.config.corpus == 'geo': GeoWorld(self.config).run() #elif self.config.corpus == 'atis': # SlotChecker(self.config).run() else: QueryComparer(self.config).run()
# -*- coding: utf-8 -*- from PyQt4.QtGui import QApplication import os import sys from mainWindow import MainWindow from datamodel import DataModel from moses import Moses if __name__ == "__main__": app = QApplication(sys.argv) workdir = os.path.join(os.path.join(os.path.expanduser('~'), 'mosesgui')) if not os.path.exists(workdir): os.makedirs(workdir) dm = DataModel(filename=os.path.join(workdir, "models.sqlite")) moses = Moses() if not moses.detect(): sys.exit(1) MainWindow = MainWindow(dm=dm, moses=moses, workdir=workdir) MainWindow.setupUi(MainWindow) MainWindow.show() sys.exit(app.exec_())