RiTa.hasWord() should return true for plurals and conjugations
RiTa.hasWord('dog') // is true
RiTa.hasWord('dogs') // is false, should be true
would also be nice to add an isStem(input) function,
which returns true if stemming a word in the dictionary return the input word
+1 for isStem(input) which should, it seems, just have the current behavior of hasWord()
hmm not sure if this is the best way but I did this:
RiTa.hasWord(word) will call RiTa.lexicon().hasWord(word, true, false) which now take three parameters: word, fatal, strict, strict is newly added, if true, will not allow plurals and conjugations
isStem(word) will return true if 1. word is in the dictionary (with strict mode) & 2. it is the same after stemming
@Real-John-Cheung this seems problematic to me:
RiTa.isStem(RiTa.stem("change")) // returns false
maybe we can do something like this https://github.com/dhowe/ritajs/blob/141ad6c6f2cf454e79c5fed023deddd1593014ba/src/conjugator.js#L208
for isStem() too...
@Real-John-Cheung status?
@dhowe not sure if I get the idea correctly...
So now we have hasWord() that returns true when the base form of the input is in the dictionary
and isStem() should have the behavior that returns true when the input is the result of stem(aWordInTheDictionary)?
e.g isStem(RiTa.stem(change)) should return true and isStem("change")should return false
hasWord(word, opts) should return true if the word is in the dictionary OR it is a derivation of a dictionary word, unless opts.noDerivations is set to true
isStem(word) should return true if calling stem() on some dictionary word, or its derivation, returns that word
isStem('chang') -> true because calling stem('change') -> 'chang' and 'change' is in the dictionary
isStem('change') -> false because there is no word W for which calling stem(W) returns 'change'
Note: it is not clear to me how to implement isStem() in a correct/efficient way
isStem() now available via RiTa.lexicon().isStem(word)