Skip to content

Commit

Permalink
Cleaned up comments
Browse files Browse the repository at this point in the history
  • Loading branch information
FenixFeather committed Feb 22, 2015
1 parent 18c2f67 commit c0f8afa
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions vigenere.jl
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,6 @@ function guess_key(text::String, key_length::Int64, places=Int64[])
slice = text[key_index:key_length:end]
frequencies = frequency_dict(slice)
rankings = sort(collect(keys(frequencies)), rev=true, by=key->frequencies[key])
## println(length(places))
## println(key_index)
## println(rankings)
## println(places[key_index])
most_popular = rankings[min(length(rankings), places[key_index])]
push!(result, (most_popular - 'e' + 52) % 26 + 'a')
end
Expand Down Expand Up @@ -107,7 +103,7 @@ function learn_key(ciphertext::String, key_length::Int64, epsilon::Float64, epoc
end

function preprocess_text(text::String)
return lowercase(replace(text, " ", ""))
return lowercase(join([isalpha(c) ? c : "" for c in text],""))
end

function frequency_difference(text_dict::Dict{Char, Int64})
Expand Down

0 comments on commit c0f8afa

Please sign in to comment.