guile-words is a Guile port of the [Vocabulary](https://github.com/prodicus/vocabulary) Python library that displays meanings, synonyms, antonyms and more for a given word.

guile-words is primarily provided as a library but it includes example programs that function as command-line applications to make use of it. An interesting bonus that comes from using the Guile programming language is that the library becomes immediately available in C (and C++) programs and libraries as well.

The program makes use of several online dictionaries:

– Wordnik

– Glosbe (not yet implemented)

– BighugeLabs

– Urbandict

## Requirements

Aside from a correct Guile installation, the library also requires

guile-json

## Installation

Download the tar file or clone a git reository

git clone https://github.com/pasoev/guile-words.git

put the words.scm (or the compiled .go) file in the Guile site

package, typically

    /usr/share/guile/site/

## Usage examples

### The Scheme library

(use-modules (words))

(antonym "good") 

 => (ant bad evil bad badness evil evilness ill)

(synonym "poor")

 => (syn hapless miserable misfortunate pathetic

 ... piteous pitiable pitiful wretched inadequate short poor people people)

(hyphenation "momentary")

 => [{"seq":0,"text":"mo","type":"stress"},

 ... {"seq":1,"text":"men"},{"seq":2,"text":"ta"},{"seq":3,"text":"ry"}]

## Reference

### Available functions

– meaning

– synonym

– antonym

– similar

– related

– hyphenation

– pronunciation

### Adding new actions

Every high-level look up command added as a function to the Scheme

library immediately becomes available to the C application.

#### Adding actions to already supported backends

Add a new action to the action list 

(define actions

   '((#:meaning . "define")

     (#:synonym . "syn")

     (#:antonym . "ant")

     (#:related . "rel")

     (#:similar . "sim")

     (#:usage-examples . "usage-examples")

     (#:hyphenation . "hyphenation")

     (#:pronunciation . "pronunciations")

     (#:define . "definitions"))

     (#:newaction . "newaction" )) ; <== Your new action here

* Define a high level function that calls the existing backend service

and pass the newly defined action to it:

(define (similar word)

    (parse-bighuge word #:newaction))

### The C client program

app synonym good

=> full estimable honorable respectable beneficial just upright

... expert practiced proficient skillful skilful dear near

depend quality vantage well thoroughly soundly

Leave a Reply

Your email address will not be published. Required fields are marked *