Open simongray opened 6 years ago
SortedSet + a sorting function is probably the best approach for this.
Can it be done already on the backend and then survive being transmitted by transit?
Will certain sorting only be applicable on the frontend? Probably not, but filtering might apply.
Rather than taking the aforementioned approach, instead consider this:
Use CoreNLP to give each definition a word class by its root word. Group as in classic dictionaries in numbered lists (as now) but under each word category, e.g. noun, verb, adjective, adverb. This is much easier on the eyes, easier to scan for the correct definition ("I need a verb") and uses more of the unused whitespace.
Similarly, when showing the search results, only show the definitions that are of that word same word class with the searched for definition first.
another alternative approach is to use wordnet instead and use the synset groups to determine word class by using the word class that has the most synset connections among the other definitions. If no connections exist, then the CoreNLP method can be used as a fall back.
This would hopefully categorise "kind" as an adjective when grouped with "generous" "gentle" etc. and as a noun when grouped with "sort" or "type". Then for those longer definitions, CoreNLP might be strongest: "a gentle soul" -> noun "trying too hard" -> verb or maybe adverb?