Guest User

Synonyms

a guest
Jul 5th, 2018
152
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Sub Synonyms
  2. Dim language As New com.sun.star.lang.Locale
  3. language.Language = "hu"
  4. language.Country = "HU"
  5. thes = createUnoService("com.sun.star.linguistic2.Thesaurus")
  6. Doc = ThisComponent
  7. Pars = ThisComponent.Text.createEnumeration
  8. While Pars.hasMoreElements
  9. TextElement = Pars.nextElement
  10. If TextElement.supportsService("com.sun.star.text.Paragraph") Then
  11. Word = TextElement.String
  12. result = thes.queryMeanings(Word, language, Array())
  13. If not IsNull(result) Then
  14. stems = Word
  15. For Each i In result
  16. synonyms = i.querySynonyms
  17. For Each j In synonyms
  18. stems = stems + " " + j
  19. Next j
  20. Next i
  21. TextElement.String = stems
  22. End If
  23. End If
  24. WEnd
  25. End Sub
RAW Paste Data