def MetaMap_init(self, dir_MetaMap): """ Get the information from MetaMapped files. Format: 1. args 2. aas 3. neg_list 4. utterance A list of (phrase, candidate, mappings) 5. 'EOU': End of Utterance Marker. """ MetaMapinput = open(dir_MetaMap, "rU") MetaMap_info = MetaMapinput.readlines() MetaMap_len = len(MetaMap_info) line_idx = 0 while line_idx < MetaMap_len: line = MetaMap_info[line_idx] line_idx += 1 if line.startswith("neg_list"): self.neg_list = parse.neg_list(line, self.summary_pos) continue if line.startswith("utterance"): utterance_tmp = {} utterance_tmp["Info"] = parse.utterance_info(line) utterance_tmp["Component"] = [] while line_idx < MetaMap_len: phrase_tmp = MetaMap_info[line_idx] candidate_tmp = MetaMap_info[line_idx + 1] mapping_tmp = MetaMap_info[line_idx + 2] utterance_tmp["Component"].append(parse.utterance_term(phrase_tmp, candidate_tmp, mapping_tmp)) line_idx += 3 if MetaMap_info[line_idx].startswith("'EOU'"): break self.utterance_list.append(parse.utterance(utterance_tmp))
def MetaMap_init(self, dir_MetaMap): ''' Get the information from MetaMapped files. Format: 1. args 2. aas 3. neg_list 4. utterance A list of (phrase, candidate, mappings) 5. 'EOU': End of Utterance Marker. ''' MetaMapinput = open(dir_MetaMap, 'rU') MetaMap_info = MetaMapinput.readlines() MetaMap_len = len(MetaMap_info) line_idx = 0 while line_idx < MetaMap_len: line = MetaMap_info[line_idx] line_idx += 1 if line.startswith('neg_list'): self.neg_list = parse.neg_list(line, self.summary_pos) continue if line.startswith('utterance'): utterance_tmp = {} utterance_tmp['Info'] = parse.utterance_info(line) utterance_tmp['Component'] = [] while (line_idx < MetaMap_len): phrase_tmp = MetaMap_info[line_idx] candidate_tmp = MetaMap_info[line_idx + 1] mapping_tmp = MetaMap_info[line_idx + 2] utterance_tmp['Component'].append( parse.utterance_term(phrase_tmp, candidate_tmp, mapping_tmp)) line_idx += 3 if MetaMap_info[line_idx].startswith("'EOU'"): break self.utterance_list.append(parse.utterance(utterance_tmp))
def __init__(self, utterance_tmp): info = parse.utterance_info(utterance_tmp['Info'])