Skip to content

Commit

Permalink
Add convenient getindex accessor for lemmas
Browse files Browse the repository at this point in the history
  • Loading branch information
jbn committed Sep 22, 2015
1 parent 9489fe2 commit c64c0c8
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/db.jl
Expand Up @@ -11,6 +11,12 @@ end

Base.show(io::IO, db::DB) = print(io, "Wordnet.DB")

function Base.getindex(db::DB, pos::Char, word::String)
db.lemmas[pos][lowercase(word)]
end

Base.getindex(db::DB, word::String, pos::Char) = db[pos, word]

function load_lemmas(base_dir)
lemmas = Dict{Char, Dict{String, Lemma}}()

Expand Down

0 comments on commit c64c0c8

Please sign in to comment.