none
Using the SynonymInfo Class library in VB.NET using VSTO RRS feed

  • Question

  • Hello,

    I guess this is the right sub form just to discuss this topic regarding the SynonymInfo under the Range class object.

    Here is the code snippet below.  See if any user can figure this out.

    Set mySynInfo = Selection.Range.SynonymInfo
    If mySynInfo.MeaningCount <> 0 Then
        myList = mySynInfo.MeaningList
        myPos = mySynInfo.PartOfSpeechList
        For i = 1 To UBound(myPos)
            Select Case myPos(i)
                Case wdAdjective
                     pos = "adjective"
                Case wdNoun
                     pos = "noun"
                Case wdAdverb
                     pos = "adverb"
                Case wdVerb
                     pos = "verb"
                Case Else
                     pos = "other"
            End Select
            MsgBox myList(i) & " found as " & pos
        Next i
    Else
        MsgBox "There were no meanings found."
    End If
    

    In addition, here is the link to where I may have misplaced the topic in the VB.NET sub form thread, since I am shifting away from the rich text control related topics. Coming in a few minutes.

    Regards,

    JohnDBCTX


    jp

    Thursday, June 21, 2018 5:55 PM

All replies

  • Here is the link to where I have this question, but in the wrong forum thread.

    Using VSTO in VB.net IDE

    My apologies for misleading the right topic in the wrong thread.

    In addition, I have misspelled the word, forum, as form.

    Regards,

    JohnDBCTX


    jp

    Thursday, June 21, 2018 6:00 PM
  • Hello JohnDBCTX,

    Do you want to convert the VBA code to VB.net?

    If so, please refer to below code. If not, please detail your issue.

    Imports Word = Microsoft.Office.Interop.Word


    Dim xlApp As Word.Application = Globals.ThisAddIn.Application Dim mySynInfo As Word.SynonymInfo Dim myList As Object Dim myPos As Object Dim pos As String mySynInfo = xlApp.Selection.Range.SynonymInfo If mySynInfo.MeaningCount <> 0 Then myList = mySynInfo.MeaningList myPos = mySynInfo.PartOfSpeechList For i = 1 To UBound(myPos) Select Case myPos(i) Case Word.WdPartOfSpeech.wdAdjective pos = "adjective" Case Word.WdPartOfSpeech.wdAdjective pos = "noun" Case Word.WdPartOfSpeech.wdAdjective pos = "adverb" Case Word.WdPartOfSpeech.wdAdjective pos = "verb" Case Else pos = "other" End Select MsgBox(myList(i) & " found as " & pos) Next i Else MsgBox("There were no meanings found.") End If

    Best Regards,

    Terry


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Friday, June 22, 2018 2:18 AM
  • Yes.  

    In addition, I want to identify the speech of a word user inputs.

    For example: user inputs "Use"

    Result output:

    Use - (Noun)

    Use - (Verb)

    Furthermore, I want to identify the morphemes of the word "Use". Some more examples:

    User inputs "Use"

    Result output:

    Related morpheme:

    Using - (Verb)

    Uses - (Verb)

    Used - (Adjective)

    Usage - (Noun)

    The goal is to apply these morphemes for annotation purposes; so that, users can annotate better and avoid accidental plagiarism for essay writing purposes.

    Regards,

    JohnDBCTX


    jp

    Friday, June 22, 2018 2:46 AM
  • Hello JohnDBCTX,

    As far as I know, SynonymInfo provides AntonymList,SynonymList,MeaningList,PartOfSpeechList, RelatedExpressionList and RelatedWordList.

    However, I think none of them could do the work as you want.

    I think it is impossible to do this using Word Object Model.

    Thanks for understanding,

    Best Regards,

    Terry


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Friday, June 22, 2018 5:14 AM
  • If it is impossible to perform that task using the Word Object Model within the Microsoft Office Suite, then

    are there any other apps that specialize in English morphemes and other related morphologies?

    Regards,

    JohnDBCTX


    jp

    Saturday, June 23, 2018 1:10 AM
  • Hello JohnDBCTX,

    This forum is for discussing about Word Object Model. Since Word Object Model does not support this function, I would suggest you mark any helpful reply or your reply to close the thread.

    For any other apps/api, I would suggest you google search.

    Thanks for understanding,

    Best Regards,

    Terry


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, June 25, 2018 9:59 AM