Ejemplo n.º 1
0
# counter = EntityCounterRepositoryMongo(url_root=path_mongo,
#                                        host=ip_mongo,
#                                        port=port_mongo,
#                                        collection="entities_count")
matcher = MeraMatcher(graph=graph,
                      artist_ngrams_repository=artist_ngrams,
                      song_ngrams_repository=song_ngrams,
                      entity_counter_repository=counter)

generator = GraphGeneratorPersistingArtist(mera_graph=graph,
                                           repo_artist=artist_ngrams,
                                           repo_songs=song_ngrams,
                                           repo_counter=counter,
                                           mera_matcher=matcher,
                                           file_path_index_artist="files/little_artist_index_dict.txt")
song_parser = DiscogsSongParserFiltering(file_path="files/discogs_releases.xml",
                                         target_indexes=set_of_songs,
                                         dataset=dataset,
                                         target_ids=set_of_ids_aol.union(set_of_musicbrainz_ids))
print "Starting artists generators...."
generator.generate_turtle_artist_graph("files/artist.ttl", artist_parser=artist_parser)
artist_ngrams.save_content("files/artist_stage_artist_ngrams.json")
song_ngrams.save_content("files/artist_stage_song_ngrams.json")
counter.save_content("files/artsit_stage_counter.json")
print "Artists complete, strating song generators...."
generator.generate_turtle_song_graph("files/complete_graph.ttl", song_parser=song_parser, isolated=True)
artist_ngrams.save_content("files/final_stage_artist_ngrams.json")
song_ngrams.save_content("files/final_stage_song_ngrams.json")
counter.save_content("files/final_stage_counter.json")