本文整理汇总了Python中Helper.blue_scores_fn方法的典型用法代码示例。如果您正苦于以下问题:Python Helper.blue_scores_fn方法的具体用法?Python Helper.blue_scores_fn怎么用?Python Helper.blue_scores_fn使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Helper
的用法示例。
在下文中一共展示了Helper.blue_scores_fn方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: translation
# 需要导入模块: import Helper [as 别名]
# 或者: from Helper import blue_scores_fn [as 别名]
####
# This will perform translation (monotone & lattice) on two
# dummy sentences. Also, all FSTs will be drawn, so you can easily
# inspect the FSTs. The dummies are called 'blackdog' and 'freundin'
# and all files are stored in results-blackdog-[monotone/lattice]
# (Note: we did not make permutation data for the freundin dummysentence,
# hence there's no lattice translation for that.)
from Helper import *
from all_tasks import *
if __name__ == "__main__":
for exp_type in ['blackdog-monotone', 'blackdog-lattice', 'freundin-monotone']:
root = "../results-%s/" % exp_type
print "\n" + "-"*80 + "\nSTARTING %s" % exp_type
print "All files will be written to the folder "+root
# Initialize helper
H = Helper(exp_type, root=root)
H.blue_scores_fn = root+"%s-bleu-scores.txt" % exp_type
# Go!
do_tasks(H, exp_type=exp_type.split("-")[1], bleu=True, draw=True)
示例2: files
# 需要导入模块: import Helper [as 别名]
# 或者: from Helper import blue_scores_fn [as 别名]
# Simply uncomment the experiment and run. The bleu scores in the
# ../results/bleu-scores file will be put in a unique file,
# but all other files (fsts) are overwritten. Results are written to th
# folder `results`. Running all experiments takes quite a while...
from Helper import *
from all_tasks import *
from copy import copy
if __name__ == "__main__":
# EXPERIMENT 1
# Monotone translation on 100 sentences
print "\n" + "-"*80 + "\nEXPERIMENT 1"
H = Helper("all-monotone")
H.blue_scores_fn = "../results/blue-scores/E01-mono-bleu-scores.txt"
do_tasks(H, draw=False, bleu=True)
# EXPERIMENT 2
# Lattice translation on 100 sentences
# print "\n" + "-"*80 + "\nEXPERIMENT 2"
# H = Helper("all-lattice")
# H.blue_scores_fn = "../results/blue-scores/E02-lat-bleu-scores.txt"
# do_tasks(H, tasks=[0,5,2,3,4], draw=False, bleu=True)
# # EXPERIMENT 3
# # Monotone translation on full corpus
# print "\n" + "-"*80 + "\nEXPERIMENT 3"
# H = Helper("all-monotone")
# H.num_sentences = 1416
# H.blue_scores_fn = "../results/blue-scores/E03-mono-bleu-scores.txt"
示例3: results
# 需要导入模块: import Helper [as 别名]
# 或者: from Helper import blue_scores_fn [as 别名]
####
# The main experiments
#
# Here we do monotone and lattice translation of the first 100 sentences
# in ../data/dev.en. The results (all FSTs created in the process and the
# BLEU scores) are stored the folders `results-monotone` and `results-lattice`.
#
# All further experiments can be found in `experiments-auxiliary.py`. It is also
# recommended to run `experiments_dummies.py`.
from Helper import *
from all_tasks import *
if __name__ == "__main__":
# Monotone translation on 100 sentences
root = "../results-monotone/"
print "\n" + "-"*80 + "\nMONOTONE TRANSLATION"
print "This can take a while. All files will be written to"\
+ " the folder "+root+"\nThere you can also find the BLEU scores."
H = Helper("all-monotone", root=root)
H.num_sentences = 100
H.blue_scores_fn = root+"monotone-bleu-scores.txt"
do_tasks(H, tasks=[0,1,2,3,4], exp_type="monotone", bleu=True, draw=False)