<commit_before>using DataFrames

user_ids = Set{UTF8String}()
# In the end we will only write out user_ids as vertices if they have at least one neighbour
used_user_ids = Set{UTF8String}()
let artists_u = Dict{UTF8String, Vector{UTF8String}}()
    let data = readtable("../jams.csv", header=false), len = length(data[:,2])
        for i in 1:len
            if isna(data[i,3])
                continue
            end
            user_id::UTF8String = data[i,2]
            push!(user_ids, user_id)
            artist::UTF8String = data[i,3]
            if !haskey(artists_u, artist)
                artists_u[artist] = UTF8String[]
            end
            push!(artists_u[artist], user_id)
        end
    end
    @printf("Number of vertices: %d\n", length(user_ids))

    len = length(artists_u)
    i = 0
    for artist in artists_u
        if i % 100 == 0
            @printf("\rProcessing artist crossproduct % 6d/%d (% 3d%%)", i, len, div(i*100,len))
        end
        i += 1
        if length(artist[2]) > 0
            for user in artist[2]
                push!(used_user_ids, user)
            end
        end
    end
    println()
end

graph_file = open("cojam3.graphml", "a")

print("Writing vertices…")
for user in user_ids
    @printf(graph_file, "\t<node id=\"%s\" />\n", user)
end
println("done.")
close(graph_file)<commit_msg>Add min_intersection support to cojam-artist vertex generation<commit_after>using DataFrames

min_intersection = int(ARGS[1])

user_ids = Set{UTF8String}()
# In the end we will only write out user_ids as vertices if they have at least one neighbour
used_user_ids = Set{UTF8String}()
let artists_u = Dict{UTF8String, Vector{UTF8String}}()
    let data = readtable("../jams.csv", header=false), len = length(data[:,2])
        for i in 1:len
            if isna(data[i,3])
                continue
            end
            user_id::UTF8String = data[i,2]
            push!(user_ids, user_id)
            artist::UTF8String = data[i,3]
            if !haskey(artists_u, artist)
                artists_u[artist] = UTF8String[]
            end
            push!(artists_u[artist], user_id)
        end
    end
    @printf("Number of vertices: %d\n", length(user_ids))

    len = length(artists_u)
    i = 0
    for artist in artists_u
        if i % 100 == 0
            @printf("\rProcessing artist crossproduct % 6d/%d (% 3d%%)", i, len, div(i*100,len))
        end
        i += 1
        if length(artist[2]) > 0
            for user in artist[2]
                push!(used_user_ids, user)
            end
        end
    end
    println()
end

graph_file = open(string("cojam-artists-", min_intersection, ".graphml"), "a")

print("Writing vertices…")
for user in user_ids
    @printf(graph_file, "\t<node id=\"%s\" />\n", user)
end
println("done.")
close(graph_file)
{'fraction_non_alphanumeric': 0.1263307310149042, 'fraction_numerical': 0.0191625266146203, 'mean_word_length': 2.2627314814814814, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4732045', 'n_tokens_mistral': 957, 'n_tokens_neox': 920, 'n_words': 243}