Exemplo n.º 1
0
def save_document_triples(data, dataset=FLAGS.dataset):
    path = io.get_document_triples_path(dataset)
    io.write_pickle(path, data)
    csv_path = path.replace(".pickle.bz2", ".csv")
    io.write_csv(csv_path,
                 data,
                 sep=",",
                 header=["doc1", "doc2", "relations", "detail"])
Exemplo n.º 2
0
def save_ordered_document_triples_metrics(data,
                                          edge_type,
                                          dataset=FLAGS.dataset):
    path = io.get_ordered_document_triples_metrics_path(edge_type, dataset)
    io.write_csv(path,
                 data,
                 sep=",",
                 header=[
                     "doc1", "doc2", "count", "idf", "idf_wiki", "count_norm",
                     "count_norm_pmi", "idf_norm", "idf_wiki_norm",
                     "idf_norm_pmi", "idf_wiki_norm_pmi"
                 ])
Exemplo n.º 3
0
def save_document_triples_metrics(data, dataset=FLAGS.dataset):
    path = io.get_document_triples_metrics_path(dataset)
    io.write_pickle(path, data)
    csv_path = path.replace(".pickle.bz2", ".csv")

    io.write_csv(csv_path,
                 data,
                 sep=",",
                 header=[
                     "doc1", "doc2", "count", "idf", "idf_wiki", "count_norm",
                     "count_norm_pmi", "idf_norm", "idf_wiki_norm",
                     "idf_norm_pmi", "idf_wiki_norm_pmi"
                 ])
Exemplo n.º 4
0
def save_eval_logs(data, dataset=FLAGS.dataset, version=FLAGS.version):
    io.write_csv(io.get_eval_log_path(dataset, version), data, sep=';')
Exemplo n.º 5
0
def save_document_embeddings(data, layer):
    io.write_csv(io.get_document_embeddings_path(layer), data.numpy(), sep=",")
Exemplo n.º 6
0
def save_filtered_triples(data, dataset=FLAGS.dataset):
    io.write_csv(io.get_filtered_word_triples_path(dataset),
                 data,
                 sep=",",
                 header=["entity1", "relations", "entity2"])
Exemplo n.º 7
0
def save_all_relations(data):
    io.write_csv(
        io.get_all_wiki_relations_path(),
        data,
        sep="+",
        header=["ID", "label", "description", "aliases", "type", "count"])
Exemplo n.º 8
0
def save_filtered_relations(data):
    io.write_csv(io.get_filtered_wiki_relations_path(),
                 data,
                 sep="+",
                 header=["ID"])
Exemplo n.º 9
0
def save_doc2idf(data, dataset=FLAGS.dataset):
    io.write_csv(io.get_doc2idf_path(dataset),
                 data,
                 sep=",",
                 header=["doc", "relation", "idf", "idf_wiki"])
Exemplo n.º 10
0
def save_doc2id(data, dataset=FLAGS.dataset):
    io.write_csv(io.get_doc2id_path(dataset),
                 data,
                 sep=",",
                 header=["doc", "wikiID"])
Exemplo n.º 11
0
def save_entity2id(data, dataset=FLAGS.dataset):
    io.write_csv(io.get_entity2id_path(dataset),
                 data,
                 sep=",",
                 header=["word", "wikiID"])