Title: | WordNet Interface |
---|---|
Description: | An interface to WordNet using the Jawbone Java API to WordNet. WordNet (<https://wordnet.princeton.edu/>) is a large lexical database of English. Nouns, verbs, adjectives and adverbs are grouped into sets of cognitive synonyms (synsets), each expressing a distinct concept. Synsets are interlinked by means of conceptual-semantic and lexical relations. Please note that WordNet(R) is a registered tradename. 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>). The WordNet database files need to be made available separately, either via package 'wordnetDicts' from <https://datacube.wu.ac.at>, installing system packages where available, or direct download from <https://wordnetcode.princeton.edu/3.0/WNdb-3.0.tar.gz>. |
Authors: | Ingo Feinerer [aut], Kurt Hornik [aut, cre] , Mike Wallace [ctb, cph] (Jawbone Java WordNet API library) |
Maintainer: | Kurt Hornik <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.1-17 |
Built: | 2024-11-06 06:31:51 UTC |
Source: | CRAN |
The package wordnet tries to locate a valid WordNet installation
on start up by investigating the WNHOME environment variable and
by trying default installation locations. On success it acquires a
pointer to the actual WordNet dictionary and stores internally a
reference to the dictionary instance. getDict
returns this
default reference.
getDict()
getDict()
You can manually point the package to the WordNet installation via
setDict
.
A dictionary instance.
Ingo Feinerer
C. Fellbaum (1998). WordNet: An Electronic Lexical Database. Cambridge, MA: MIT Press. https://mitpress.mit.edu/9780262561167/
M. Wallace (2007). Jawbone Java WordNet API. https://sites.google.com/site/mfwallace/jawbone
if(initDict()) getDict()
if(initDict()) getDict()
Returns an instance to a WordNet dictionary.
getDictInstance()
getDictInstance()
A dictionary object.
Ingo Feinerer
M. Wallace (2007). Jawbone Java WordNet API. https://sites.google.com/site/mfwallace/jawbone
if(initDict()) getDictInstance()
if(initDict()) getDictInstance()
Get available filter types.
getFilterTypes()
getFilterTypes()
A character vector with available filter types.
Ingo Feinerer
M. Wallace (2007). Jawbone Java WordNet API. https://sites.google.com/site/mfwallace/jawbone
getFilterTypes()
getFilterTypes()
Get index terms from a WordNet dictionary as specified by a filter.
getIndexTerms(pos, maxLimit, filter)
getIndexTerms(pos, maxLimit, filter)
pos |
Part of speech type.
Must be either |
maxLimit |
Maximum number of results. |
filter |
A term filter (see |
A list of index terms.
Ingo Feinerer
M. Wallace (2007). Jawbone Java WordNet API. https://sites.google.com/site/mfwallace/jawbone
if(initDict()) { filter <- getTermFilter("StartsWithFilter", "car", TRUE) getIndexTerms("NOUN", 5, filter) }
if(initDict()) { filter <- getTermFilter("StartsWithFilter", "car", TRUE) getIndexTerms("NOUN", 5, filter) }
Retrieve the lemma (i.e., word) of an index term.
getLemma(indexterm)
getLemma(indexterm)
indexterm |
The index term whose lemma is returned. |
A character vector holding the index term lemma.
Ingo Feinerer
M. Wallace (2007). Jawbone Java WordNet API. https://sites.google.com/site/mfwallace/jawbone
if(initDict()) { filter <- getTermFilter("StartsWithFilter", "car", TRUE) terms <- getIndexTerms("NOUN", 5, filter) sapply(terms, getLemma) }
if(initDict()) { filter <- getTermFilter("StartsWithFilter", "car", TRUE) terms <- getIndexTerms("NOUN", 5, filter) sapply(terms, getLemma) }
Get related synsets for a given synset based on a pointer symbol.
getRelatedSynsets(synset, pointerSymbol)
getRelatedSynsets(synset, pointerSymbol)
synset |
Basic synset. |
pointerSymbol |
A symbol indicating the type of the related synsets. An overview is available at https://wordnet.princeton.edu/documentation/wnsearch3wn. |
A list of synsets.
Ingo Feinerer
M. Wallace (2007). Jawbone Java WordNet API. https://sites.google.com/site/mfwallace/jawbone
if(initDict()) { filter <- getTermFilter("ExactMatchFilter", "hot", TRUE) terms <- getIndexTerms("ADJECTIVE", 5, filter) synsets <- getSynsets(terms[[1]]) related <- getRelatedSynsets(synsets[[1]], "!") sapply(related, getWord) }
if(initDict()) { filter <- getTermFilter("ExactMatchFilter", "hot", TRUE) terms <- getIndexTerms("ADJECTIVE", 5, filter) synsets <- getSynsets(terms[[1]]) related <- getRelatedSynsets(synsets[[1]], "!") sapply(related, getWord) }
Get synonyms for a given index term.
getSynonyms(indexterm)
getSynonyms(indexterm)
indexterm |
The input index term. |
A character vector holding the synonyms for the given index term.
Ingo Feinerer
M. Wallace (2007). Jawbone Java WordNet API. https://sites.google.com/site/mfwallace/jawbone
if(initDict()) { filter <- getTermFilter("ExactMatchFilter", "company", TRUE) terms <- getIndexTerms("NOUN", 5, filter) getSynonyms(terms[[1]]) }
if(initDict()) { filter <- getTermFilter("ExactMatchFilter", "company", TRUE) terms <- getIndexTerms("NOUN", 5, filter) getSynonyms(terms[[1]]) }
Get synsets for a given index term.
getSynsets(indexterm)
getSynsets(indexterm)
indexterm |
The input index term. |
A list of synsets.
Ingo Feinerer
M. Wallace (2007). Jawbone Java WordNet API. https://sites.google.com/site/mfwallace/jawbone
if(initDict()) { filter <- getTermFilter("ExactMatchFilter", "hot", TRUE) terms <- getIndexTerms("ADJECTIVE", 5, filter) getSynsets(terms[[1]]) }
if(initDict()) { filter <- getTermFilter("ExactMatchFilter", "hot", TRUE) terms <- getIndexTerms("ADJECTIVE", 5, filter) getSynsets(terms[[1]]) }
Get a term filter.
getTermFilter(type, word, ignoreCase)
getTermFilter(type, word, ignoreCase)
type |
Filter type.
Available filters are |
word |
Term to be matched. |
ignoreCase |
Indicates whether lower and upper case are distinguished. |
A term filter.
Ingo Feinerer
M. Wallace (2007). Jawbone Java WordNet API. https://sites.google.com/site/mfwallace/jawbone
if(initDict()) getTermFilter("StartsWithFilter", "car", TRUE)
if(initDict()) getTermFilter("StartsWithFilter", "car", TRUE)
Get the words in a synset.
getWord(synset)
getWord(synset)
synset |
The synset whose words are returned. |
A character vector holding the words.
Ingo Feinerer
M. Wallace (2007). Jawbone Java WordNet API. https://sites.google.com/site/mfwallace/jawbone
if(initDict()) { filter <- getTermFilter("ExactMatchFilter", "hot", TRUE) terms <- getIndexTerms("ADJECTIVE", 5, filter) synsets <- getSynsets(terms[[1]]) related <- getRelatedSynsets(synsets[[1]], "!") sapply(related, getWord) }
if(initDict()) { filter <- getTermFilter("ExactMatchFilter", "hot", TRUE) terms <- getIndexTerms("ADJECTIVE", 5, filter) synsets <- getSynsets(terms[[1]]) related <- getRelatedSynsets(synsets[[1]], "!") sapply(related, getWord) }
Initializes the WordNet dictionary using the Jawbone Java API to WordNet.
initDict(pathData = "")
initDict(pathData = "")
pathData |
Path to the WordNet data files. |
In case the user supplied path is invalid the function tries to find the installation itself by investigating the WNHOME environment variable and by trying default installation locations.
A logical value indicating whether a valid WordNet installation has been found.
Ingo Feinerer
C. Fellbaum (1998). WordNet: An Electronic Lexical Database. Cambridge, MA: MIT Press. https://mitpress.mit.edu/9780262561167/
M. Wallace (2007). Jawbone Java WordNet API. https://sites.google.com/site/mfwallace/jawbone
## Not run: initDict("/usr/local/WordNet-3.0/dict")
## Not run: initDict("/usr/local/WordNet-3.0/dict")
The package wordnet tries to locate a valid WordNet installation on start up by investigating the WNHOME environment variable and by trying default installation locations. On success it acquires a pointer to the actual WordNet dictionary and stores internally a reference to the dictionary instance. However, if this procedure does not work automatically in your environment, you can provide the path to the WordNet installation and set the internal default reference via this function.
setDict(pathData)
setDict(pathData)
pathData |
Path to the WordNet data files. |
A dictionary instance.
Ingo Feinerer
C. Fellbaum (1998). WordNet: An Electronic Lexical Database. Cambridge, MA: MIT Press. https://mitpress.mit.edu/9780262561167/
M. Wallace (2007). Jawbone Java WordNet API. https://sites.google.com/site/mfwallace/jawbone
## Not run: setDict("/usr/local/WordNet-3.0/dict")
## Not run: setDict("/usr/local/WordNet-3.0/dict")
Get synonyms for a given word.
synonyms(word, pos)
synonyms(word, pos)
word |
The input word. |
pos |
Part of speech type.
Must be either |
A character vector holding the synonyms for the given word.
Ingo Feinerer
if(initDict()) synonyms("company", "NOUN")
if(initDict()) synonyms("company", "NOUN")