An open API service indexing awesome lists of open source software.

https://github.com/phoe/wordnet

Common Lisp interface to WordNet - modernized
https://github.com/phoe/wordnet

Last synced: 4 months ago
JSON representation

Common Lisp interface to WordNet - modernized

Awesome Lists containing this project

README

          

## Background and Introduction

[Professor George Miller](https://en.wikipedia.org/wiki/George_Armitage_Miller) of the [Cognitive Science Laboratory](http://cogsci.princeton.edu/) of [Princeton University](http://www.princeton.edu/) directed the development a lexicographic database called [WordNet](https://wordnet.princeton.edu/).

Princeton maintained a server through which the WordNet database could be browsed via the World Wide Web, however, the online version of WordNet has been deprecated and is no longer available, so if you would like to use WordNet in your research, you can [download](https://wordnet.princeton.edu/download) the database.

The WordNet database is implemented as a set of [text files](data-file-format.text). [Mark Nahabedian](https://www.linkedin.com/in/mark-nahabedian-15a225/) has developed an interface to this database written in [Common Lisp](https://www.cs.cmu.edu/Groups/AI/html/cltl/cltl2.html). This software provides an interface by which Common Lisp programs can access lexicographic data from WordNet.

## 2 Min Overview

#### Some Exported Functions

A complete list can be found in [packages.lisp](packages.lisp) with more documentation [here](https://github.com/phoe/wordnet).

_wordnet_

- synsets-containing-word/s
- get-synonyms
- get-antonyms
- synset-words
- part-of-speech
- cached-index-lookup
- index-entry-synsets

NOTE 1: A point of note is the `part-of-speech`. Arguments with this name can take the value `:noun`, `:adjective`, `:verb` or `:adverb`.

NOTE 2: I am not the author - these examples and explanations are all that I understand. There is more documentation available at the [original repo](https://github.com/phoe/wordnet#data-representation) - this is a forked one. Further, I have made part-of-speech as an optional argument in `synsets-containing-word/s`, and `get-synonyms`; the former function is named `synsets-containing-words` in the original repo.

#### Class Hierarchy

```lisp
(wordnet-object ;; private
(wordnet-synset-entry
(wordnet-noun-entry
wordnet-verb-entry
wordnet-adjective-entry
wordnet-adverb-entry)
(wordnet-index-entry)
(wordnet-pointer))
```

#### Examples

```lisp
CL-USER> (ql:quickload 'wordnet)
(WORDNET)

CL-USER> (use-package :wordnet)
T

CL-USER> (setq dog-synsets (synsets-containing-word/s "dog" :noun)
;; The first argument could be :dog or "dog" as well
;; The second argument is optional, if given, it could be :verb, :adverb or :adjective
(#
#
#
#
#
#
#)

CL-USER> (get-synonyms :joy)
;; an optional argument specifying part-of-speech can also be supplied
(("joy" 0) ("joyousness" 0) ("joyfulness" 0) ("joy" 0) ("delight" 0)
("pleasure" 0))

CL-USER> (get-antonyms 'joy :noun)
;; part-of-speech is not optional here
("sorrow")

;;; ======== The above functions are implemented in examples.lisp ==========
;; The list of the exported functions can be found in packages.lisp.

CL-USER> (synset-words (first dog-synsets))
(("dog" 0) ("domestic_dog" 0) ("Canis_familiaris" 0))

CL-USER> (part-of-speech (first dog-synsets))
:NOUN

CL-USER> (setq dog (cached-index-lookup 'dog :noun))
#

CL-USER> (setq dog-synsets (index-entry-synsets dog))
(#
#
#
#
#
#
#)

```