Get Related Words in Microsoft Word Thesaurus using vb.net

Good Morning! It has been an eventful weekend. Usually I don’t do a lot of posting on non business days but events have overtaken me a bit. First the first beta of the Automatic Tag Generator for Windows Live Writer Plugin was completed. If you are interested in testing it you can get it here.  Be sure to place it in your plugins folder for Windows Live Writer, usually at “C:\Program Files\Windows Live\Writer\Plugins”. Don’t forget to leave me feedback ok? Next, we had our 10,000th page view last night so another posting was as a result of that. And finally, I did my sharing thing earlier that I like to do on Sundays so I did another posting for that. Throw on top of that some really unpleasant weather here so it was actually pretty busy.

But it is Monday so back to work. While writing the tag generator, it became necessary to review the results were returned by the Microsoft Word Thesaurus of words that were related to the word I was searching for. Why? Well at times if you were to look for the word “rumors” in the thesaurus it would return no definitions but it would return related words to “rumors” which might be important to what you were writing about. So here it is. We write all the related words to a string for this example. Note the loop uses “1” instead of “0” as Microsoft Word is not zero based. Make it a great day!

Sub GetRelatedWords(ByVal QueryWord as String)

Dim Word as New Word.Application

Dim mySynInfo = Word.Application.SynonymInfo(QueryWord)
Dim myPos = mySynInfo.PartOfSpeechList
Dim relList = mySynInfo.RelatedWordList

If UBound(relList) > 0 And mySynInfo.MeaningCount = 0 Then
For i = 1 To UBound(relList)
teststring2 = teststring2 & ” ” & relList(i)
Next i
End If

End Sub

Technorati Tags: ,,,,,,,,,,,,,,,,,,,,,,,,,

Windows Live Tags: vb.net,c#,.NET Framework,tag,Related Words,Microsoft,Word,Thesaurus,Automatic,Generator,Live,Writer,Plugin,folder,feedback,example,Application,SynonymInfo,PartOfSpeechList,RelatedWordList,UBound,MeaningCount,Windows,definition,mySynInfo,relList

Advertisements
  1. Leave a comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: