Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Replacing a word by synonyms in Haskell

I was going through this plagiarism detector and trying to write a program in Haskell which will read a file and replace some of its words with synonyms. Is there any dictionary available for this purpose in Haskell?

Also, if you have any input regarding algorithm or any other input relevant for this problem, like how to avoid changing the context of a statement by replacing a word by its synonyms, then please post it.

like image 985
keep_learning Avatar asked Oct 24 '22 22:10

keep_learning


1 Answers

is there any dictionary available for this purpose in Haskell?

I would imagine that what you are looking for is a plain text file, something like this:

word1: word1synonym1, word1synonym2, ...
word2: word2synonym1, ...
...

In which case it wouldn't really be Haskell-specific. I'm unaware of any free text-file thesauruses like this, though I imagine if you dig around LibreOffice you would probably find one.

how to avoid changing the context of a statement by replacing a word by its synonyms

This is very hard for a computer to do, afaik. I would suggest not expending much effort working on this aspect of it.

any input regarding algorithm

You may find the concept of edit distance useful for this problem. See Approximate string matching and Wagner-Fischer algorithm.

like image 194
Dan Burton Avatar answered Oct 30 '22 08:10

Dan Burton