diff --git a/src/files.jl b/src/files.jl index 900d11c..f1bf513 100644 --- a/src/files.jl +++ b/src/files.jl @@ -98,7 +98,7 @@ function _load_gz_embeddings(filepath::S1, if word in keep_words || no_custom_words if lang in keys(LANGUAGES) && LANGUAGES[lang] in languages # use only languages mapped in LANGUAGES _llang = LANGUAGES[lang] - if !(_llang in keys(lang_embs)) + if !haskey(lang_embs, _llang) push!(lang_embs, _llang=>Dict{type_word, type_vector}()) push!(fuzzy_words, _llang=>type_word[]) end @@ -147,9 +147,9 @@ function _load_hdf5_embeddings(filepath::S1, cnt = 0 for (idx, (lang, word)) in enumerate(words) if word in keep_words || no_custom_words - if lang in keys(LANGUAGES) && LANGUAGES[lang] in languages # use only languages mapped in LANGUAGES + if haskey(LANGUAGES, lang) && LANGUAGES[lang] in languages # use only languages mapped in LANGUAGES _llang = LANGUAGES[lang] - if !(_llang in keys(lang_embs)) + if !haskey(lang_embs, _llang) push!(lang_embs, _llang=>Dict{type_word, type_vector}()) push!(fuzzy_words, _llang=>type_word[]) end diff --git a/src/interface.jl b/src/interface.jl index cca4ec2..79aa5d8 100644 --- a/src/interface.jl +++ b/src/interface.jl @@ -142,7 +142,7 @@ size(conceptnet::ConceptNet, inds...) = (conceptnet.width, length(conceptnet))[i function in(key::S, conceptnet::ConceptNet) where S<:AbstractString found = false for lang in keys(conceptnet.embeddings) - if key in keys(conceptnet.embeddings[lang]) + if haskey(conceptnet.embeddings[lang], key) found = true break end @@ -151,7 +151,7 @@ function in(key::S, conceptnet::ConceptNet) where S<:AbstractString end function in(lang::L, conceptnet::ConceptNet) where L<:Languages.Language - return lang in keys(conceptnet.embeddings) + return haskey(conceptnet.embeddings, lang) end