def build_demo_data(kvl): label_store = LabelStore(kvl) topic = 'where_are_aid_workers_housed_near_Monrovia' subtopics = ['Tanji_Fish_Curing_Site', 'Camp_Ramrod', 'Town_of_Wamba'] subtopic_to_documents = { 0: [(random_sid(), '2100-%d|%s' % (len(subtopics[0]), subtopics[0]), 3), (random_sid(), '15-93|we_drove_out_to_the_other_side_' + 'of_the_river_delta_to_a_small_fish_smoking_camp', 2) ], 1: [(random_sid(), '3120-%d|%s' % (len(subtopics[1]), subtopics[1]), 2), (random_sid(), '200-217|Ramrod_(Facility)', 3) ], 2: [(random_sid(), '3120-%d|%s' % (len(subtopics[2]), subtopics[2]), 3), (random_sid(), '53-63|Wamba_Town', 2), (random_sid(), '44-50|Woomba', 1) ] } for idx, subtopic in enumerate(subtopics): for stream_id, subtopic_id2, rating in subtopic_to_documents[idx]: print stream_id label = Label(topic, stream_id, 'John', CorefValue.Positive, subtopic_id1=subtopic, subtopic_id2=subtopic_id2, rating=rating) label_store.put(label)
def build_demo_data(kvl): label_store = LabelStore(kvl) topic = 'where_are_aid_workers_housed_near_Monrovia' subtopics = ['Tanji_Fish_Curing_Site', 'Camp_Ramrod', 'Town_of_Wamba'] subtopic_to_documents = { 0: [(random_sid(), '2100-%d|%s' % (len(subtopics[0]), subtopics[0]), 3), (random_sid(), '15-93|we_drove_out_to_the_other_side_' + 'of_the_river_delta_to_a_small_fish_smoking_camp', 2)], 1: [(random_sid(), '3120-%d|%s' % (len(subtopics[1]), subtopics[1]), 2), (random_sid(), '200-217|Ramrod_(Facility)', 3)], 2: [(random_sid(), '3120-%d|%s' % (len(subtopics[2]), subtopics[2]), 3), (random_sid(), '53-63|Wamba_Town', 2), (random_sid(), '44-50|Woomba', 1)] } for idx, subtopic in enumerate(subtopics): for stream_id, subtopic_id2, rating in subtopic_to_documents[idx]: print stream_id label = Label(topic, stream_id, 'John', CorefValue.Positive, subtopic_id1=subtopic, subtopic_id2=subtopic_id2, rating=rating) label_store.put(label)
def build_test_data(kvl): topics = ['topic1', 'topic2', 'topic3'] subtopics = ['subtopic1', 'subtopic2', 'subtopic3'] relevances = [[1, 2, 3]]*3 offset = '13-235' label_store = LabelStore(kvl) for t_idx, topic in enumerate(topics): for s_idx, subtopic in enumerate(subtopics): label = Label(topic, 'doc'+str(t_idx)+str(s_idx), 'me', CorefValue.Positive, subtopic_id1=subtopic, subtopic_id2=offset+'|'+'some text', relevance=relevances[t_idx][s_idx]) label_store.put(label)
def build_test_data(kvl): topics = ['topic1', 'topic2', 'topic3'] subtopics = ['subtopic1', 'subtopic2', 'subtopic3'] relevances = [[1, 2, 3]] * 3 offset = '13-235' label_store = LabelStore(kvl) for t_idx, topic in enumerate(topics): for s_idx, subtopic in enumerate(subtopics): label = Label(topic, 'doc' + str(t_idx) + str(s_idx), 'me', CorefValue.Positive, subtopic_id1=subtopic, subtopic_id2=offset + '|' + 'some text', relevance=relevances[t_idx][s_idx]) label_store.put(label)
def build_test_data(kvl): topics = ['topic1', 'topic2', 'topic3'] subtopics = ['subtopic1', 'subtopic2', 'subtopic3'] offset = '13,235' ratings = [[1, 2, 3]]*3 label_store = LabelStore(kvl) for t_idx, topic in enumerate(topics): for s_idx, subtopic in enumerate(subtopics): meta = dict(topic_name=topic, topic_id=str(t_idx), passage_text='howdy', subtopic_name='bye bye', ) label = Label(str(t_idx), 'doc'+str(t_idx)+str(s_idx), 'me', CorefValue.Positive, subtopic_id1=subtopic, subtopic_id2=offset, rating=ratings[t_idx][s_idx], meta=meta, ) label_store.put(label)