caarmen / poet-assistant

Android app with rhyming dictionary, thesaurus, and dictionary, with text-to-speech functionality to read your poem.
Other
83 stars 11 forks source link

Wish: combined rhyme+thesaurus search #3

Closed LuccoJ closed 8 years ago

LuccoJ commented 8 years ago

A common question when writing poetry is "which word could I use that roughly means the same as A, but which rhymes with the word B that I used in the other verse?".

So, it would be nice to combine the rhyming lookup with the thesaurus lookup to obtain this. Since WordNet is being used as a thesaurus, I would suggest going further than direct synonyms and using the more loosely-related links in WordNet to maximize the chances of finding a hit.

caarmen commented 8 years ago

Hello LuccoJ,

Many thanks for your suggestion!

Just for info, the thesaurus should already be displaying the loosely-related words, although the UI labels them as "synonyms" (a UI choice for simplicity). The code which parses the WordNet 2.0 thesaurus is in another project. The parser is here: https://github.com/caarmen/thesaurus/blob/master/library/src/main/java/ca/rmen/thesaurus/WordNetThesaurusReader.java That project has a tool to read the WordNet text file and convert the data to an SQLite database, which is used inside this app. Basically, when parsing the text file, I treat "antonym" words as "antonyms" and other related words as "synonyms".

Just as a side note: I guess the same info might be available in WordNet 3.0 (which I use for the dictionary), but I discovered that after I already implemented the thesaurus based on WordNet 2.0, with the already nicely formatted th_en_US_v2.dat file.

As for "which word could I use that roughly means the same as A, but which rhymes with the word B?", it sounds like a useful feature indeed. I hope I can find some time to implement it :)

Cheers, Carmen

caarmen commented 8 years ago

Just for info, the bit that treats loosely-related words as synonyms is this:

// The "antonym" qualifier means this related word goes into the antonyms list.
if("antonym".equals(typeOfWord)) antonyms.add(relatedWord);
// All other qualifiers: the word goes to the synonyms list
else synonyms.add(relatedWord);

(https://github.com/caarmen/thesaurus/blob/master/library/src/main/java/ca/rmen/thesaurus/WordNetThesaurusReader.java#L111 )

LuccoJ commented 8 years ago

Uhm, it might be overkill to treat all non-antonyms as synonyms in the general thesaurus, since WordNet really does list a lot of relationship types between words. I was thinking it would be appropriate when combined with the rhymer because otherwise, chances are there would be no results for most searches, without getting a little imaginative about word connections.

caarmen commented 8 years ago

I've implemented something for the cross-lookups between the rhymer and thesaurus. I will test it out a bit more before publishing a new release.

I personally haven't found that the Thesaurus shows way too many results. But maybe my reluctance to modify that part of the code is influencing my bias :P

caarmen commented 8 years ago

The app offers:

The screenshots below show example searches.


screenshot_2016-05-21-14-41-02 screenshot_2016-05-21-14-41-07