tags:

views:

90

answers:

3

I am creating an application in .net.

I got running application name http://www.spinnerchief.com/ . this exactly working what i need but i didn't get any help from goggle.

I need functionality for my application where user give one sentence and get more similar type sentence like this example.

This is an example what i require.

Suppose i put a sentence that Pankaj is a good man. Then i need output like this.

Pankaj is a great   person. 
Pankaj is a superb   man. 
Pankaj is a good   guy. 
Pankaj is a great   dude. 
Pankaj is a superb   male. 
Pankaj is a good   person. 

Please help me to solve this problem.

A: 

I don't know anything about .Net, but you should look into using a dictionary function (I'm sure there is one, or at least a library that streamlines the process if there isn't).

Then, you'd have to go through the string, and ommit words like "is" or "a". Only taking words you want to have synonyms for.

After this, its pretty simple to have a loop spit out your sentences.

Good luck.

pAT
+1  A: 

To do this correctly for any arbitrary sentence you would need to perform natural language analysis of the source sentence. You may want to look into the SharpNLP library - it's a free library of natural language processing tools for C#/.NET.

If you're looking for a simpler approach, you have to be willing to sacrifice correctness to some degree. For instance, you could create a dictionary of trigger words, which - when they appear in a sentence - are replaced with synonyms from a thesaurus. The problem with this approach is making sure that you replace a word with an equivalent part of speech. In English, it's possible for certain words to be different parts of speech (verb, adjective, adverb, etc) based on their contextual usage in a sentence.

An additional consideration you'll need to address (if you're not using an NLP library) is stemming. In most languages, certain parts of speech are conjugated/modified (verbs in English) based on the subject they apply to (or the object, speaker, or tense of the sentence).

If all you want to do is replace adjectives (as in your example) the approach of using trigger words may work - but it won't be readily extensible. Before you do anything, I would suggest that you clearly defined the requirements and rules for your problem domain ... and use that to decide which route to take.

LBushkin
+1  A: 

For this, the best thing for you to use is WordNet and it's hyponym/hypernym relations. There is a WordNet .Net library. For each word you want to alternate, you can either get it's hypernym (i.e. for person, a hypernym means "person is a kind of...") or hyponym ("X is a kind of person"). Then just replace the word you are alternating.

You will want to make sure you have the correct part-of-speech (i.e. noun, adjective, verb...) and there is also the issue of senses, which may introduce some undesired alternations (sense #1 is the most common).

msbmsb