def main(linked_dir, labeled_out, score, core_weight, score_fes, debug, numerical): """ this script is the actual unsupervised approach which produces labeled data out of entity linked sentences """ labeled = process_dir(linked_dir, score_fes, debug, numerical) if score: for sentence in labeled: sentence['score'] = compute_score(sentence, score, core_weight) if not score_fes: [fe.pop('score') for fe in sentence['FEs']] with codecs.open(labeled_out, 'wb', 'utf8') as f: json.dump(labeled, f, ensure_ascii=False, indent=2)
def main(classified_output, output_file, id_to_title, triple_scores, \ format, sentence_score, core_weight, fe_score): """ serializes the classification result into triples optionally scoring sentences and/or frame elements """ sentences = read_sentences(classified_output) labeled = to_labeled(sentences, fe_score) if sentence_score != 'nothing': for sentence in labeled: sentence['score'] = compute_score(sentence, sentence_score, core_weight) mapping = json.load(id_to_title) processed, discarded = to_assertions(labeled, mapping, output_file, triple_scores, format)