Antonym List Property Problem

R

Runt

Dear Whoever,

I'm trying to write a macro which will identify the antonym of a given
word, but I've struck a problem.

Before identifying the antonym I have to identify which meaning of the
word is required (the word 'go' has 8 meanings - each having a
different opposite meaning or no opposite meaning at all).

I am able to select the correct meaning of the word and assign it the
appropriate number in the MeaningList. However, the MeaningList number
does not correspond with the AntonymList number (while there might be
8 meanings for a word there might only be 4 antonyms for the same
word). So the 7th meaning of the word 'go' might correspond with the
4th Antonym of 'go'.

Is it possible to identify the antonym of a given meaning of a given
word using VBA. The Word Thesaurus is certainly able to.

I hope I've made myself clear. If not, here is the (rather messy) code
I'm working on.

Thanks in advance,

Chris


Sub antonymFind()

Set myAntObj = Selection.Range.SynonymInfo

If myAntObj.Found = True Then
relList = myAntObj.RelatedWordList
If UBound(relList) <> 0 Then
word2 = relList(1)
Set myAntObj = SynonymInfo(word2)
End If
Else
MsgBox "Sorry. No antonyms were found for the word '" &
myAntObj.Word & "'"
End
End If

Alistfound = myAntObj.Found

If Alistfound = False Then

End If

MCount = myAntObj.MeaningCount

If MCount < 2 Then
i = 1
GoTo runmacro
End If

MsgBox "'" & myAntObj.Word & "' has " & MCount & " meanings"

For i = 1 To MCount
Mlist = myAntObj.MeaningList
Answer = MsgBox("Is it a synonym of '" & Mlist(i) & "'",
vbYesNo, "What does the word mean?")
Select Case Answer
Case vbYes
'Put the code here that runs in response to Yes

GoTo runmacro
Case vbNo
'Put the code here that runs in response to No
If i = MCount Then
MsgBox "There are no more recorded meanings for the
word '" & myAntObj.Word & "'"
End
End If
End Select
Next i

runmacro:

Alist = myAntObj.AntonymList

If UBound(Alist) <> 0 Then

Selection.EndKey Unit:=wdStory

Selection.TypeParagraph
Selection.TypeParagraph
Selection.Font.Bold = False
Selection.TypeText Text:="Which word in the text is opposite in
meaning to: "
Selection.TypeParagraph

Selection.Font.Bold = True
Selection.TypeText Text:=Alist(i)
Else
MsgBox "Sorry. No antonyms were found for the word '" &
myAntObj.Word & "'"
End If

End Sub
 
J

Jezebel

I extremely sceptical that you're able to identify the meaning of a word
from its context. How do you reduce 'go' to eight meanings? My Shorter
Oxford lists 85 meanings for 'go', under seven different headings. I doubt
you can even reliably distinguish 'go' as a noun from 'go' as a verb ("It's
your go" vs "It's your turn to go").

To propose the antonym of a word presumes that you can identify its part of
speech; and if you've solved that problem the world would love to hear from
you. One of the major AI projects gave up on the sentence 'Time flies like
an arrow' which has at least five sytntactically valid interpretations
(Fruit flies like a banana.) It might be obvious to you and me that 'time'
can't be an imperative verb in that context (get out your stopwatch and time
the flies the way you'd time an arrow...?), but that's a damned difficult
notion to put into software.
 
H

Helmut Weber

Hi Jezebel,
"giant waves down funnel"
was the according example when I studied English,
long long time ago.
Greetings from Bavaria, Germany
Helmut Weber
"red.sys" & chr$(64) & "t-online.de"
 
J

Jezebel

Excellent! Or try selecting a meaning, let alone an antonym, for ANY word in
"Colourless green ideas sleep furiously."

Bunte nicht-grüne Sachen wecken friedlich auf?

(Sorry if my German is lousy, but I learnt it in Bavaria. Too much damned
beer.)
 
R

Runt

Sorry, but I didn't make myself clear. I'm not an AI genius! After
highlighting the word (e.g. 'go') the user is asked which meaning of
the word is appropriate. Depending on which meaning the user chooses,
I would like the macro to return the correct antonym.

Unfortunatly though, the chosen position (i) on the meaninglist does
not correspond with the position on the antonymlist.

Any ideas?
 
H

Helmut Weber

"Farblose grüne Ideen schlafen wutentbrannt."
As I've actually studied english linguistics,
it's not the first time I'm reading this sentence.
Besides that I'm quite confident bavarian beverages
didn't do you any harm.
Ciao.
Greetings from Bavaria, Germany
Helmut Weber
 
W

Word Heretic

G'day (e-mail address removed) (Runt),

from the VBE help:

You can check the value of the MeaningCount property to prevent
potential errors in your code. The following example returns a list of
synonyms for the second meaning for the word or phrase in the
selection and displays these synonyms in the Immediate pane.

Set synInfo = Selection.Range.SynonymInfo
If synInfo.MeaningCount >= 2 Then
synList = synInfo.SynonymList(2)
For i = 1 To UBound(synList)
Debug.Print synList(i)
Next i
Else
MsgBox "There is no second meaning for the selection."
End If



(e-mail address removed) (Runt) was spinning this yarn:
Sorry, but I didn't make myself clear. I'm not an AI genius! After
highlighting the word (e.g. 'go') the user is asked which meaning of
the word is appropriate. Depending on which meaning the user chooses,
I would like the macro to return the correct antonym.

Unfortunatly though, the chosen position (i) on the meaninglist does
not correspond with the position on the antonymlist.

Any ideas?

Steve Hudson

Word Heretic, Sydney, Australia
Tricky stuff with Word or words for you.
wordheretic.com

If my answers r 2 terse, ask again or hassle an MVP,
at least they get recognition for it then.
Lengthy replies offlist require payment.
 
R

Runt

I appreciate the help but, the problem remains unanswered, so here
goes again...

I'm trying to write a macro which will identify the antonym of a given
meaning of a given word.

Firstly the USER is asked to identify which meaning of the word is the
correct one (the word 'go' has 8 meanings in the MS Word Dictionary -
each having a different antonym or no antonym at all).

Once the USER has selected the meaning of the word the from the
MeaningList Property the appropriate number (i) in the MeaningList is
assigned. However, the MeaningList number does not correspond with the
AntonymList number (while there might be 8 meanings for a word there
might only be 4 antonyms for the same
word). So the 7th meaning of the word 'go' might correspond with the
4th Antonym of 'go'.

Is it possible to identify the antonym of a given meaning of a given
word using VBA? The Word Thesaurus is certainly able to do it.

Waiting patiently for someone who might enlighten me.

Thank you,

Chris
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top