Exemplo n.º 1
0
    def __init__(self, text_path, all_graph_path, song_graph_path):

        text_file, all_graph_file, song_graph_file = self.load(
            text_path, all_graph_path, song_graph_path)

        self.all_edges = self.load_edges(all_graph_file)
        self.song_edges = self.load_edges(song_graph_file)

        logging.info('len(self.all_edges) is: {}'.format(len(self.all_edges)))
        logging.info('len(self.song_edges) is: {}'.format(len(
            self.song_edges)))
        self.text, self.num_vocab, self.num_song_nodes = self.load_text(
            text_file)

        logging.info('len(self.text) is: {}'.format(len(self.text)))

        logging.info('self.num_vocab is: {}'.format(self.num_vocab))
        logging.info('self.num_nodes is: {}'.format(self.num_song_nodes))

        if self.num_song_nodes != 361570:
            for i in range(10):
                logging.info(
                    'self.num_song_nodes changes from {} to {}'.format(
                        self.num_song_nodes, 361570))
            # self.num_song_nodes = 361570

        self.all_negative_table = InitNegTable(self.all_edges)
        self.song_negative_table = InitNegTable(self.song_edges)
        logging.info('len(self.all_negative_table) is: {}'.format(
            len(self.all_negative_table)))
        logging.info('len(self.song_negative_table) is: {}'.format(
            len(self.song_negative_table)))

        self.all_exist_node1_node2set_dict, self.num_all_nodes = self.get_exist_node1_node2set_dict(
            self.all_edges)
        self.song_exist_node1_node2set_dict, self.num_song_nodes_temp = self.get_exist_node1_node2set_dict(
            self.song_edges)
        logging.info('self.num_all_nodes is: {}'.format(self.num_all_nodes))
        logging.info('self.num_song_nodes_temp is: {}'.format(
            self.num_song_nodes_temp))
        # check the node count
        true_all_node_manually = 361570 + 4284 + 165472
        if self.num_all_nodes != true_all_node_manually:
            for i in range(10):
                logging.info('self.num_all_nodes changes from {} to {}'.format(
                    self.num_all_nodes, true_all_node_manually))
Exemplo n.º 2
0
 def __init__(self, text_path, graph_path, batch_size, sentence_len):
     text_file, graph_file = self.load(text_path, graph_path)
     self.graph_path = graph_path
     self.sentence_len = sentence_len
     self.edges = self.load_edges(graph_file)
     self.text, self.num_vocab, self.num_nodes = self.load_text(text_file)
     self.batch_size = batch_size
     self.negative_table = InitNegTable(self.edges)
Exemplo n.º 3
0
    def __init__(self, text_path, graph_path):

        text_file, graph_file = self.load(text_path, graph_path)

        self.edges = self.load_edges(graph_file)

        self.text, self.num_vocab, self.num_nodes = self.load_text(text_file)

        self.negative_table = InitNegTable(self.edges)