def evaluateResults(self, gold_mlf, hyp_mlf=None): if gold_mlf in GOLD_MLF: key = gold_mlf build_dir = self.settings['BUILD_DIR'] gold_mlf = os.path.join(build_dir, GOLD_MLF[key]) hyp_mlf = os.path.join(build_dir, HYP_MLF[key]) elif hyp_mlf is None: raise ValueError('If you use path for `gold_mlf`, you must supply `hyp_mlf`') only = self.settings.get('SRESULTS_ONLY', None) skip = self.settings.get('SRESULTS_SKIP', None) output = StringIO() td = TreeDistScript() results = td.sresults((gold_mlf, hyp_mlf), fw=output, only=only, skip=skip) cued = commands.getoutput(self.settings['SRC_DIR']+'/cuedSemScore.pl -d '+hyp_mlf+'.cued '+gold_mlf+'.cued') ## self.logger.info('CUED SemScore.pl: %s', cued) cued = cued.split() try: results['sActAcc'] = float(cued[0]) results['iP'] = float(cued[1]) results['iR'] = float(cued[2]) results['iF'] = float(cued[3]) except ValueError: results['sActAcc'] = 0.0 results['iP'] = 0.0 results['iR'] = 0.0 results['iF'] = 0.0 self.printResults(results) return results
def evaluateResults(self, gold_mlf, hyp_mlf=None): if gold_mlf in GOLD_MLF: key = gold_mlf build_dir = self.externalEnv['BUILD_DIR'] gold_mlf = os.path.join(build_dir, GOLD_MLF[key]) hyp_mlf = os.path.join(build_dir, HYP_MLF[key]) elif hyp_mlf is None: raise ValueError( 'If you use path for `gold_mlf`, you must supply `hyp_mlf`') output = StringIO() td = TreeDistScript() results = td.sresults((gold_mlf, hyp_mlf), fw=output) self.printResults(results) return results
def evaluateResults(self, gold_mlf, hyp_mlf=None): if gold_mlf in GOLD_MLF: key = gold_mlf build_dir = self.settings['BUILD_DIR'] gold_mlf = os.path.join(build_dir, GOLD_MLF[key]) hyp_mlf = os.path.join(build_dir, HYP_MLF[key]) elif hyp_mlf is None: raise ValueError( 'If you use path for `gold_mlf`, you must supply `hyp_mlf`') only = self.settings.get('SRESULTS_ONLY', None) skip = self.settings.get('SRESULTS_SKIP', None) output = StringIO() td = TreeDistScript() results = td.sresults((gold_mlf, hyp_mlf), fw=output, only=only, skip=skip) cued = commands.getoutput(self.settings['SRC_DIR'] + '/cuedSemScore.pl -d ' + hyp_mlf + '.cued ' + gold_mlf + '.cued') ## self.logger.info('CUED SemScore.pl: %s', cued) cued = cued.split() try: results['sActAcc'] = float(cued[0]) results['iP'] = float(cued[1]) results['iR'] = float(cued[2]) results['iF'] = float(cued[3]) except ValueError: results['sActAcc'] = 0.0 results['iP'] = 0.0 results['iR'] = 0.0 results['iF'] = 0.0 self.printResults(results) return results