-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Return special value when words not found? #9
Comments
I don't think so, no. BTW, in this case you wanted to use cross-ref #10 |
This is truly a problem, either. My origin thought was that I need some methods that enable me to handle some out-of-vocabulary words without trying to catch I guess a better way to deal both of problems would be providing some methods that can also set default value? Or maybe like python's nltk wordnet, leave the synsets function without having to actually touch the like synsets(db::WordNet.DB, word::String)
synsets(db::WordNet.DB, word::String, pos::Char) |
I see nothing wrong with:
I agree. |
Does that mean we should implement DB as a subtype of Associative instead of a composite type of Dicts? |
Those things are not mutually exclusive. Maybe, |
I see. |
What about haskey(db::DB, pos::Char) = haskey(db.lemmas, pos)
haskey(db::DB, pos::Char, word::AbstractString) = haskey(db, pos) ? haskey(db.lemmas[pos], pos) : false
get(db::DB, pos::Char, word::AbstractString, default) = haskey(db, pos, word) ? db.lemmas[pos][word] : default
get(db::DB, word::AbstractString, pos::Char, default) = get(db, pos, word, default) |
Looks sensible enough to me. |
Currently WordNet.jl get
KeyError
when searching for words not in the database,For example:
Will it be better to return something like a empty Lemma for such situation?
The text was updated successfully, but these errors were encountered: