Package 'sehrnett'

Title: A Very Nice Interface to 'WordNet'
Description: A very nice interface to Princeton's 'WordNet' without 'rJava' dependency. 'WordNet' data is not included. Princeton University makes 'WordNet' available to research and commercial users free of charge provided the terms of their license (<https://wordnet.princeton.edu/license-and-commercial-use>) are followed, and proper reference is made to the project using an appropriate citation (<https://wordnet.princeton.edu/citing-wordnet>).
Authors: Chung-hong Chan [aut, cre]
Maintainer: Chung-hong Chan <[email protected]>
License: GPL (>= 3)
Version: 0.1.0
Built: 2025-02-21 04:00:02 UTC
Source: https://github.com/chainsawriot/sehrnett

Help Index


Download And Delete WordNet SQL Database

Description

To download the WordNet 3.1 data as a sqlite database. It runs only in an interactive R session. The size of the database is around 500MB. Please make sure you agree with the WordNet License.

Usage

download_wordnet(debug = FALSE)

delete_wordnet()

Arguments

debug

a flag for debugging. You should keep it FALSE. (Try at your own risk!)

Value

TRUE if the database is found. FALSE if there is no database and it is not running in an interactive R session.


Search For Lemmas in WordNet

Description

Search for lemma(s) in WordNet.

Usage

get_lemmas(
  x = c("very", "nice"),
  pos = c("n", "v", "a", "s", "r"),
  sensenum,
  lemmatize = TRUE
)

Arguments

x

character, one or more lemmas to be searched; it can also be a data.frame result from another get_ functions, but it doesn't make a lot of sense. Alternatively, you can also use the so-called dot notation ("lemma.pos.sensenum") to quickly search for an exact word sense. For example, "king.n.10" is the lemma of "king", which is a noun with the 10th word sense, i.e. king, the chess piece. When using this dot notation, the lemmatize parameter is set to FALSE.

pos

character, a vector of part-of-speech labels: "n": Noun, "v": Verb, "a": Adjective, "s": Adjective satellite, "r": Adverb

sensenum

integer, if supplied, only those sensenum are selected.

lemmatize

logical, whether to lemmatize the x before making query. This is ignored if 1) pos has more than one element, 2) x contains collocations or hyphenation.

Value

a data frame containing search result

Examples

if (interactive()) {
get_lemmas("king.n.10")
}

Get outdegrees

Description

Search for outdegrees based on linkid. Various sugars are also provided with different default linkids.

Usage

get_outdegrees(x, linkid = 1)

get_hypernyms(x)

get_hyponyms(x)

get_holonyms(x)

get_meronyms(x)

get_causes(x)

get_antonyms(x)

get_derivatives(x)

get_pertainyms(x)

list_linktypes()

Arguments

x

character, one or more Synset IDs to be searched, or a data.frame result from another get_ function

linkid

a vector of numeric linkids. Use list_linktypes() to obtain a full list.

Value

a data frame containing search result

Examples

if (interactive()) {
get_lemmas("dog", pos = "n", sensenum = 1) %>% get_outdegrees(linkid = 1)
get_lemmas("dog", pos = "n", sensenum = 1) %>% get_hyponyms()
get_lemmas("nice", pos = "a", sensenum = 1) %>% get_antonyms()
}

Search for Synset IDs in WordNet

Description

Search for Synset ID(s) in WordNet

Usage

get_synsetids(x = c("301590922", "108957024"))

get_synonyms(x)

Arguments

x

character, one or more Synset IDs to be searched, or a data.frame result from another get_ function

Value

a data frame containing search result

Examples

if (interactive()) {
  get_synsetids("106618544")
}