Use Microsoft Word Thesaurus to find the part of speech of a word with vb.net

Good Morning! The plug in I am working on for Live Writer that will automatically generate Windows Live and Technorati tags (others too if asked for) based on your blog post is coming along. I have sped up the process of creating the tags which was a huge jump for this. I took 4 seconds to generate the tags for this post for example. At the bottom of this post you will see the tags. Though you can’t see them all (which I like – the search engines will see see them regardless) I pasted them as a whole so you can review them. You will need MS Word 2000 or above installed on your machine and 3.5 of the Framework installed. One thing I need is someone who has experience writing add-ons for Live Writer to contact me or if you know someone to let me know who they are.

Anyway today’s code sample is based on this project. We want to find the part of speech of given word (noun, verb etc) using the Microsoft Word thesaurus. Make it a great day!


Join me on Facebook

Public Word As New Word.Application

Public wdAdjective As Integer = 0
    Public wdAdverb As Integer = 2
    Public wdConjunction As Integer = 5
    Public wdIdiom As Integer = 8
    Public wdInterjection As Integer = 7
    Public wdNoun As Integer = 1
    Public wdOther As Integer = 9
    Public wdPreposition As Integer = 6
    Public wdPronoun As Integer = 4
    Public wdVerb As Integer = 3

Sub GetPartOfSpeech(ByVal MyWord as String)

Dim mySynInfo = Word.Application.SynonymInfo(MyWord)
            Dim myPos = mySynInfo.PartOfSpeechList
            Dim pos As String = ""

If mySynInfo.MeaningCount <> 0 Then
               For i = 1 To UBound(myPos)
                   Select Case myPos(i)
                       Case 0
                           pos = "Adjective"
                       Case 1
                           pos = "Noun"
                       Case 2
                           pos = "Adverb"
                       Case 3
                           pos = "Verb"
                       Case 4
                           pos = "Pronoun"
                       Case 5
                           pos = "Conjunction"
                       Case 6
                           pos = "Preposition"
                       Case 7
                           pos = "Interjection"
                       Case 8
                           pos = "Idiom"
                       Case 9
                           pos = "Other"
                       Case Else
                           pos = "Unknown"
                   End Select
                  MsgBox(pos)
               Next
           Else
               pos = "Unknown"
           End If

 

Use,Microsoft,Word,Thesaurus,part,speech,net,Morning,Live,Writer,will,Windows,Technorati,post,process,You,machine,Framework,thing,someone,experience,

writing,code,sample,project,Make,day,Application,Integer,GetPartOfSpeech,ByVal,MyWord,String,SynonymInfo,PartOfSpeechList,MeaningCount,UBound,

Select,Case,Adjective,Noun,Adverb,Verb,Pronoun,Conjunction,Preposition,Interjection,Idiom,End,MsgBox,myPos,mySynInfo,wdOther,wdNoun,wdInterjection,

wdIdiom,wdConjunction,wdAdverb,tags

Advertisements
  1. #1 by Kelly on December 5, 2008 - 6:23 am

    hmmmm if you still need this let me know ok? I probably can get you a solution.

  2. #2 by Kelly on December 5, 2008 - 1:58 pm

    pm me please. Do you mean all related words to the word you are looking at? Or every single word in dictionary?

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: