本文整理汇总了Python中wiki_data.WikiQuestionGenerator方法的典型用法代码示例。如果您正苦于以下问题:Python wiki_data.WikiQuestionGenerator方法的具体用法?Python wiki_data.WikiQuestionGenerator怎么用?Python wiki_data.WikiQuestionGenerator使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wiki_data
的用法示例。
在下文中一共展示了wiki_data.WikiQuestionGenerator方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: import wiki_data [as 别名]
# 或者: from wiki_data import WikiQuestionGenerator [as 别名]
def main(args):
utility = Utility()
train_name = "random-split-1-train.examples"
dev_name = "random-split-1-dev.examples"
test_name = "pristine-unseen-tables.examples"
#load data
dat = wiki_data.WikiQuestionGenerator(train_name, dev_name, test_name, FLAGS.data_dir)
train_data, dev_data, test_data = dat.load()
utility.words = []
utility.word_ids = {}
utility.reverse_word_ids = {}
#construct vocabulary
data_utils.construct_vocab(train_data, utility)
data_utils.construct_vocab(dev_data, utility, True)
data_utils.construct_vocab(test_data, utility, True)
data_utils.add_special_words(utility)
data_utils.perform_word_cutoff(utility)
#convert data to int format and pad the inputs
train_data = data_utils.complete_wiki_processing(train_data, utility, True)
dev_data = data_utils.complete_wiki_processing(dev_data, utility, False)
test_data = data_utils.complete_wiki_processing(test_data, utility, False)
print "# train examples ", len(train_data)
print "# dev examples ", len(dev_data)
print "# test examples ", len(test_data)
print "running open source"
#construct TF graph and train or evaluate
master(train_data, dev_data, utility)
示例2: main
# 需要导入模块: import wiki_data [as 别名]
# 或者: from wiki_data import WikiQuestionGenerator [as 别名]
def main(args):
utility = Utility()
train_name = "random-split-1-train.examples"
dev_name = "random-split-1-dev.examples"
test_name = "pristine-unseen-tables.examples"
#load data
dat = wiki_data.WikiQuestionGenerator(train_name, dev_name, test_name, FLAGS.data_dir)
train_data, dev_data, test_data = dat.load()
utility.words = []
utility.word_ids = {}
utility.reverse_word_ids = {}
#construct vocabulary
data_utils.construct_vocab(train_data, utility)
data_utils.construct_vocab(dev_data, utility, True)
data_utils.construct_vocab(test_data, utility, True)
data_utils.add_special_words(utility)
data_utils.perform_word_cutoff(utility)
#convert data to int format and pad the inputs
train_data = data_utils.complete_wiki_processing(train_data, utility, True)
dev_data = data_utils.complete_wiki_processing(dev_data, utility, False)
test_data = data_utils.complete_wiki_processing(test_data, utility, False)
print("# train examples ", len(train_data))
print("# dev examples ", len(dev_data))
print("# test examples ", len(test_data))
print("running open source")
#construct TF graph and train or evaluate
master(train_data, dev_data, utility)