doches/rwordnet

Performance: part-of-speech handling causes extra Lemma cache entries

kliuless opened this issue · 0 comments

Related to #28:

Part-of-spech inconsistencies cause duplicate entries to be created in the Lemma cache:

[49] pry(main)> WordNet::Lemma.class_variable_get(:@@cache).clear
=> {}
[50] pry(main)> WordNet::Lemma.find('turtle', :n)
[51] pry(main)> WordNet::Lemma.find('turtle', 'noun')
[52] pry(main)> WordNet::Lemma.class_variable_get(:@@cache).keys
=> [:noun, "noun"]

One specific example is that Lemma.find_all uses symbols, while Synset.find_all uses strings, causing 4 duplicate cache entries.