synonyms: Search For Synonyms

Description Usage Arguments Value References Examples

View source: R/synonyms.R

Description

synonyms - Search for synonyms that match term(s).

synonyms_frame - Generate a synonym lookup hash key for use with the synonym.frame argument in the synonym function.

Usage

1
2
3
4
5
6
7
8
9
synonyms(terms, return.list = TRUE, multiwords = TRUE, report.null = TRUE,
  synonym.frame = qdapDictionaries::key.syn)

syn(terms, return.list = TRUE, multiwords = TRUE, report.null = TRUE,
  synonym.frame = qdapDictionaries::key.syn)

synonyms_frame(synonym.list, prior.frame)

syn_frame(synonym.list, prior.frame)

Arguments

terms

The terms to find synonyms for.

return.list

logical. If TRUE returns the output for multiple synonyms as a list by search term rather than a vector.

multiwords

logical. IF TRUE retains vector elements that contain phrases (defined as having one or more spaces) rather than a single word.

report.null

logical. If TRUE reports the words that no match was found at the head of the output.

synonym.frame

A dataframe or hash key of positive/negative words and weights.

synonym.list

A named list of lists (or vectors) of synonyms.

prior.frame

A prior synonyms data.frame in the format produced by synonyms_frame.

Value

Returns a list of vectors or vector of possible words that match term(s).

References

The synonyms dictionary (see key.syn) was generated by web scraping the Reverso Online Dictionary. The word list fed to Reverso is the unique words from the combination of DICTIONARY and labMT.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
## Not run: 
synonyms(c("the", "cat", "job", "environment", "read", "teach"))
head(syn(c("the", "cat", "job", "environment", "read", "teach"), 
    return.list = FALSE), 30)
syn(c("the", "cat", "job", "environment", "read", "teach"), multiwords = FALSE)

## User defined synonym lookup
syn_dat <- list(
    like = list(c("want", "desire"), c("love", "care")),
    show = list(c("reveal"), c("movie", "opera")),
    R = c("old friend", "statistics language")
)

synonyms_frame(syn_dat)
syn(c("R", "show"), synonym.frame = syn_frame(syn_dat))

syns.hash <- syn_frame(syn_dat, prior.frame = qdapDictionaries::key.syn)
syn(c("R", "show", "like", "robot"), synonym.frame = syns.hash)

## End(Not run)

Example output

Loading required package: qdapDictionaries
Loading required package: qdapRegex
Loading required package: qdapTools
Loading required package: RColorBrewer
OpenJDK 64-Bit Server VM warning: Can't detect initial thread stack location - find_vma failed

Attaching package: 'qdap'

The following object is masked from 'package:base':

    Filter

no match for the following:

the
========================

$cat.def_1
[1] "feline"    "gib"       "grimalkin" "kitty"     "malkin"   

$cat.def_2
[1] "moggy"

$cat.def_3
[1] "mouser" "puss"  

$cat.def_4
[1] "pussy"

$cat.def_5
[1] "tabby"

$job.def_1
 [1] "affair"         "assignment"     "charge"         "chore"         
 [5] "concern"        "contribution"   "duty"           "enterprise"    
 [9] "errand"         "function"       "pursuit"        "responsibility"
[13] "role"           "stint"          "task"           "undertaking"   
[17] "venture"        "work"          

$job.def_2
 [1] "business"   "calling"    "capacity"   "career"     "craft"     
 [6] "employment" "function"   "livelihood" "metier"     "occupation"
[11] "office"     "position"   "post"       "profession" "situation" 
[16] "trade"      "vocation"  

$job.def_3
 [1] "allotment"   "assignment"  "batch"       "commission"  "consignment"
 [6] "contract"    "lot"         "output"      "piece"       "portion"    
[11] "product"     "share"      

$environment.def_1
 [1] "atmosphere"   "background"   "conditions"   "context"      "domain"      
 [6] "element"      "habitat"      "locale"       "medium"       "milieu"      
[11] "scene"        "setting"      "situation"    "surroundings" "territory"   

$environment.def_2
[1] "The environment is the natural world of land"
[2] "sea"                                         
[3] "air"                                         
[4] "plants"                                      
[5] "and animals."                                

$read.def_1
[1] "glance at"          "look at"            "peruse"            
[4] "pore over"          "refer to"           "run one's eye over"
[7] "scan"               "study"             

$read.def_2
[1] "announce" "declaim"  "deliver"  "recite"   "speak"    "utter"   

$read.def_3
[1] "comprehend"              "construe"               
[3] "decipher"                "discover"               
[5] "interpret"               "perceive the meaning of"
[7] "see"                     "understand"             

$read.def_4
[1] "display"  "indicate" "record"   "register" "show"    

$teach.def_1
 [1] "advise"          "coach"           "demonstrate"     "direct"         
 [5] "discipline"      "drill"           "edify"           "educate"        
 [9] "enlighten"       "give lessons in" "guide"           "impart"         
[13] "implant"         "inculcate"       "inform"          "instil"         
[17] "instruct"        "school"          "show"            "train"          
[21] "tutor"          

no match for the following:

the
========================

 [1] "feline"         "gib"            "grimalkin"      "kitty"         
 [5] "malkin"         "moggy"          "mouser"         "puss"          
 [9] "pussy"          "tabby"          "affair"         "assignment"    
[13] "charge"         "chore"          "concern"        "contribution"  
[17] "duty"           "enterprise"     "errand"         "function"      
[21] "pursuit"        "responsibility" "role"           "stint"         
[25] "task"           "undertaking"    "venture"        "work"          
[29] "business"       "calling"       
no match for the following:

the
========================

$cat.def_1
[1] "feline"    "gib"       "grimalkin" "kitty"     "malkin"   

$cat.def_2
[1] "moggy"

$cat.def_3
[1] "mouser" "puss"  

$cat.def_4
[1] "pussy"

$cat.def_5
[1] "tabby"

$job.def_1
 [1] "affair"         "assignment"     "charge"         "chore"         
 [5] "concern"        "contribution"   "duty"           "enterprise"    
 [9] "errand"         "function"       "pursuit"        "responsibility"
[13] "role"           "stint"          "task"           "undertaking"   
[17] "venture"        "work"          

$job.def_2
 [1] "business"   "calling"    "capacity"   "career"     "craft"     
 [6] "employment" "function"   "livelihood" "metier"     "occupation"
[11] "office"     "position"   "post"       "profession" "situation" 
[16] "trade"      "vocation"  

$job.def_3
 [1] "allotment"   "assignment"  "batch"       "commission"  "consignment"
 [6] "contract"    "lot"         "output"      "piece"       "portion"    
[11] "product"     "share"      

$environment.def_1
 [1] "atmosphere"   "background"   "conditions"   "context"      "domain"      
 [6] "element"      "habitat"      "locale"       "medium"       "milieu"      
[11] "scene"        "setting"      "situation"    "surroundings" "territory"   

$environment.def_2
[1] "sea"    "air"    "plants"

$read.def_1
[1] "peruse" "scan"   "study" 

$read.def_2
[1] "announce" "declaim"  "deliver"  "recite"   "speak"    "utter"   

$read.def_3
[1] "comprehend" "construe"   "decipher"   "discover"   "interpret" 
[6] "see"        "understand"

$read.def_4
[1] "display"  "indicate" "record"   "register" "show"    

$teach.def_1
 [1] "advise"      "coach"       "demonstrate" "direct"      "discipline" 
 [6] "drill"       "edify"       "educate"     "enlighten"   "guide"      
[11] "impart"      "implant"     "inculcate"   "inform"      "instil"     
[16] "instruct"    "school"      "show"        "train"       "tutor"      

      x                                  y
1:    R [1]old friend, statistics language
2: like [1]want, desire @@@@ [2]love, care
3: show     [1]reveal @@@@ [2]movie, opera
$R.def_1
[1] "old friend"          "statistics language"

$show.def_1
[1] "reveal"

$show.def_2
[1] "movie" "opera"

$R.def_1
[1] "old friend"          "statistics language"

$show.def_1
[1] "reveal"

$show.def_2
[1] "movie" "opera"

$like.def_1
[1] "want"   "desire"

$like.def_2
[1] "love" "care"

$robot.def_1
[1] "android"        "automaton"      "machine"        "mechanical man"

Warning message:
system call failed: Cannot allocate memory 

qdap documentation built on May 15, 2018, 9:04 a.m.