3

I'd like to use Perl to search through an offline thesaurus. I don't know if this is possible, or what the mechanics of achieving this may be

I'd like be able to

  • Have a downloaded thesaurus on a machine

  • Write a Perl program that searches through the downloaded thesaurus and spits back minimal output.

For example

=============================
Synoynms for: wiggle
- - - - - - - - - - - - - - -
wave   waggle   wag   twitch
twist  squirm   shimmy
jiggle jerk
=============================

I noticed that there's a Biblio::Thesaurus which seemed promising, but I'm totally lost as to how this module would be used unless there's a universal (or at least popular) thesaurus for the English language in ISO format freely available for download somewhere

I guess I'm looking for

  • A thesaurus for English in ISO format

  • A way of navigating this data using Perl

Borodin
  • 126,100
  • 9
  • 70
  • 144
Gary N.
  • 33
  • 1
  • 5
  • 1
    Are you looking for English English or American English? – Borodin May 05 '15 at 20:43
  • 1
    [`Lingua::Wordnet`](https://metacpan.org/pod/Lingua::Wordnet) looks promising. There's a fairly [detailed article](http://www.foo.be/docs/tpj/issues/vol5_2/tpj0502-0006.html) in the Perl Journal describing its usage. – ThisSuitIsBlackNot May 05 '15 at 22:05
  • 2
    There's also the [Moby Thesaurus](http://icon.shef.ac.uk/Moby/mthes.html), which is in the public domain. – ThisSuitIsBlackNot May 05 '15 at 22:11
  • The Perl part of this could really be as simple as a dictionary hash with arrays of synonyms as values e.g. `$thesaurus{wiggle} = [qw(wave waggle wag)]`. The offline part then would just be a matter of finding and probably some amount of transforming a publicly available data set into that Perl hash. I don't know offhand how involved the latter would be but OpenOffice and Wiktionary both have downloadable dumps. – swornabsent May 06 '15 at 17:21
  • Borodin - American English ThisSuitIsBlackNot - I'm looking into Wordnet I noticed there's a dictionary, but didn't notice if there was a thesaurus or not. I have also noticed Moby out there. swomabsent - I agree, if there were a large thesaurus available for download in *some* structured format, using Perl to navigate then just becomes a coding task. – Gary N. May 06 '15 at 17:48
  • My take on all this though: I'm just surprised that, in this day and age, there isn't a quick and automatic answer to this problem i.e. "Oh yeah, go download the Oxford English Dictionary XML file and use Purple::Nurple to parse through it" In other words, it seems like this would be a not common (but certainly not *rare*) need out there in the world. I'm surprised I'm getting pointed to some darker corners to solve it, and not a big bright one. :-/ - G – Gary N. May 06 '15 at 17:49

1 Answers1

0

For better or worse, the solution I'm working with is...

1) Downloaded the Moby Thesaurus. Data there is simple...

i.e. root word,synonym 1, synonym 2, synonym 3, etc.
e.g. hamburger, BLT, Dogwood sandwich, cheeseburger, etc.

2) Used plain-old Perl, no special module, to parse and repeat searches through the data - once it's loaded in memory.

  • G
Gary N.
  • 33
  • 1
  • 5