syn is a zero dependency R package that lists synonyms and antonyms.

There are two main functions:

• syn("great") Returns synonyms of “great”
• ant("great") Returns antonyms of “great”.

syn and ant take one word as input. To return synonyms for many words, use the plural form: syns, and ants

• syns(c("great", "excellent") Returns named list of synonyms of “great”, and “excellent”
• ants(c("great", "excellent") Returns named list of antonyms of “great”, and “excellent”

## Example: Synonyms for “cool”

The syn function returns all synonyms for a given word:

Let’s look at synonyms for “cool”:

library(syn)

syn_cool <- syn("cool")

head(syn_cool)
#> [1] "abate"          "abnegation"     "above all that" "absolute zero"
#> [5] "abstinence"     "ace-high"
tail(syn_cool)
#> [1] "withhold"       "without nerves" "wizard"         "wonderless"
#> [5] "wonderlessness" "zealless"

Wow, there are a lot! How many are there?

length(syn_cool)
#> [1] 618

Wow! There are 618 synonyms for cool. That’s…inaccessible, I guess.

You can also provide it a number of words to return with the n_words argument, which will randomly select the number of words given

syn("awesome", 1)
#> [1] "immeasurable"
syn("awesome", 2)
#> [1] "outsize" "awful"
syn("awesome", 5)
#> [1] "schrecklich"  "overwhelming" "big"          "grisly"
#> [5] "sacred"

## Example: Creating a sentence

OK cool, let’s use these in a sentence, using the glue package. Which of these better?


glue::glue("This is really cool!")
#> This is really cool!
glue::glue("This is really {syn('cool', 1)}!")
#> This is really coldhearted!
glue::glue("This is really {syn('cool', 10)}!")
#> This is really placid!
#> This is really Oriental calm!
#> This is really chromatic!
#> This is really refreshing!
#> This is really balance!
#> This is really unamicable!
#> This is really heavy!
#> This is really smashing!
#> This is really sequestrated!
#> This is really blue with cold!

## Using multiple words with syns

You can generate synonyms for multiple words with the syns function. This takes a vector of words, returning a named list

syns_good_evil <- syns(c("good", "evil"))
str(syns_good_evil)
#> List of 2
#>  $good: chr [1:667] "able to pay" "absolutely" "acceptable" "accomplished" ... #>$ evil: chr [1:365] "aberrant" "abnormal" "abominable" "abomination" ...

You can also provide n_words for syns, and it will return a random selection of the words of that number.

syns(c("good", "evil"),
n_words =  10)
#> $good #> [1] "benignly" "integrity" "rewarding" "law-abiding" "respected" #> [6] "talented" "unassumed" "lifelike" "virtuous" "fine" #> #>$evil
#>  [1] "inconvenience"  "flagitiousness" "dirty"          "immoral"
#>  [5] "atrocity"       "damage"         "flagitious"     "pain"
#>  [9] "perfidious"     "naughty"

## Example: Antonyms (under development)

To create antonyms, use ant and ants, which have the same inputs as syn. However, at this stage, the number of antonyms available for use by ant is small.

ant("good")
#> [1] "bad"  "evil"
ant("good",1)
#> [1] "evil"

ant("strong")
#> [1] "weak"
ants(c("good", "evil"))
#> $good #> [1] "bad" "evil" #> #>$evil
#> [1] "good"

ants(c("good", "evil"), n_words = 5)
#> $good #> [1] "bad" "evil" #> #>$evil
#> [1] "good"

ants(c("strong", "weak"))
#> $strong #> [1] "weak" #> #>$weak
#> [1] "strong"

## Example: Filtering by the number of words in a synonym

Let’s say that you want to filter something down to those synonyms that only contain one word. You can use the n_words argument, which calculates the number of words for each

syn_end <- syn("end")

n_words(syn_end)
#>   [1] 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 2 1 1 2 1 1 1 1 1 1 1 1 1 1 3 3 2 1 1 3
#>  [36] 2 2 2 1 1 2 2 3 2 1 1 1 2 2 1 1 2 2 1 1 2 2 1 1 1 2 1 2 2 3 1 1 1 1 1
#>  [71] 1 3 1 1 1 1 1 1 1 2 2 1 2 1 1 1 2 2 1 1 1 1 1 2 2 2 3 3 1 1 1 1 1 1 1
#> [106] 1 1 1 2 1 1 1 1 1 3 1 1 1 1 1 1 1 2 3 2 2 1 2 1 2 1 1 1 1 2 1 1 3 1 1
#> [141] 1 2 1 1 1 1 3 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 2 1 1 2 3 2 3 1 1
#> [176] 1 2 1 3 1 3 3 2 1 1 1 2 2 1 1 1 1 1 1 1 1 1 1 1 2 2 2 1 1 1 1 2 2 2 2
#> [211] 1 1 1 1 1 3 1 1 2 2 1 1 1 1 1 1 1 1 1 3 1 2 2 1 1 1 1 2 3 3 2 3 2 1 1
#> [246] 1 1 1 2 1 2 1 1 1 1 1 3 3 1 1 2 2 1 1 1 1 3 1 1 1 1 1 1 1 3 1 1 1 1 1
#> [281] 3 2 2 2 2 2 2 3 2 2 1 2 1 1 1 1 1 2 1 3 1 1 1 3 1 2 2 1 1 3 3 1 1 1 1
#> [316] 1 1 1 1 1 1 1 1 1 1 2 1 3 1 2 1 3 1 3 2 1 1 1 1 1 2 1 1 1 1 1 1 2 1 2
#> [351] 2 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 3 1 1 1 2 2 3 3 3 1 1 1 1
#> [386] 1 1 1 1 1 1 1 1 1 3 1 1 1 1 1 1 1 1 3 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 1
#> [421] 1 1 2 1 1 1 1 1 1 1 1 1 3 3 1 3 1 1 1 1 1 1 2 1 1 1 1 1 1 2 1 1 1 1 1
#> [456] 1 1 2 2 1 1 1 1 1 1 1 1 1 1 2 2 1 1 1 1 1 1 1 1 1 1 1 1 3 1 1 1 1 2 2
#> [491] 1 2 1 1 1 1 2 1 1 1 2 1 2 1 1 1 2 2 2 1 1 2 1 2 1 2 1 1 1 1 1 1 1 2 1
#> [526] 1 2 1 1 1 1 1 1 3 3 2 1 1 2 2 1 1 2 1
syn_end_l1 <- syn_end[n_words(syn_end) <= 1]
syn_end_l1
#>   [1] "abandon"         "abort"           "accomplishment"
#>   [4] "acme"            "afterglow"       "afterimage"
#>   [7] "aim"             "all"             "allotment"
#>  [10] "allowance"       "annihilate"      "annihilation"
#>  [13] "answer"          "apogee"          "archer"
#>  [16] "arrest"          "astrology"       "athlete"
#>  [19] "attend"          "balance"         "ballplayer"
#>  [22] "bane"            "baseballer"      "baseman"
#>  [25] "batter"          "battery"         "belay"
#>  [28] "bell"            "bit"             "bite"
#>  [31] "borderline"      "bound"           "boundary"
#>  [34] "bourn"           "bowman"          "budget"
#>  [37] "butt"            "by-end"          "by-purpose"
#>  [40] "cancel"          "cap"             "catastrophe"
#>  [43] "catcher"         "cease"           "ceiling"
#>  [46] "center"          "cessation"       "chaff"
#>  [49] "check"           "checkmate"       "chip"
#>  [52] "chloroform"      "chunk"           "circumscription"
#>  [55] "climax"          "clip"            "clipping"
#>  [58] "close"           "closing"         "closure"
#>  [61] "coach"           "coda"            "collop"
#>  [64] "commission"      "compass"         "competitor"
#>  [67] "complete"        "completing"      "completion"
#>  [70] "conclude"        "conclusion"      "confine"
#>  [73] "confines"        "constellation"   "consummation"
#>  [76] "contingent"      "cracking"        "cricketer"
#>  [79] "crown"           "crumb"           "culminate"
#>  [82] "culmination"     "cup"             "curtains"
#>  [85] "cut"             "cutoff"          "cutting"
#>  [88] "deadline"        "deadlock"        "deal"
#>  [91] "death"           "deathblow"       "debris"
#>  [94] "decease"         "decipherment"    "decoding"
#>  [97] "delimitation"    "demise"          "denouement"
#> [100] "departure"       "desist"          "desistance"
#> [103] "destination"     "destiny"         "destroy"
#> [106] "desuetude"       "determinant"     "determination"
#> [109] "determine"       "detritus"        "develop"
#> [112] "die"             "disappear"       "discontinuance"
#> [115] "discontinuation" "discontinue"     "disentanglement"
#> [118] "dispatch"        "dissolution"     "dividend"
#> [121] "dole"            "dollop"          "doom"
#> [124] "dying"           "end"             "endgame"
#> [127] "ending"          "ensue"           "eventuate"
#> [130] "execute"         "exit"            "expiration"
#> [133] "expire"          "explanation"     "exterminate"
#> [136] "extinction"      "extinguishment"  "extreme"
#> [139] "extremity"       "fare"            "fatality"
#> [142] "fate"            "filings"         "finale"
#> [145] "finality"        "finalize"        "finding"
#> [148] "finding-out"     "finis"           "finish"
#> [151] "finishing"       "floor"           "follow"
#> [154] "footballer"      "foredoom"        "fortune"
#> [157] "fossil"          "fragment"        "Friday"
#> [160] "frontier"        "future"          "game"
#> [163] "games-player"    "gamester"        "go"
#> [166] "goal"            "gob"             "gobbet"
#> [169] "going"           "grave"           "guard"
#> [172] "gun"             "half"            "halt"
#> [175] "halver"          "hedge"           "helping"
#> [178] "hold"            "holdover"        "hunk"
#> [181] "husks"           "immolate"        "inevitability"
#> [184] "infielder"       "interest"        "interface"
#> [187] "interpretation"  "issue"           "jock"
#> [190] "jumper"          "kill"            "kismet"
#> [193] "knell"           "leaving"         "leavings"
#> [196] "leftovers"       "limen"           "limit"
#> [199] "limitation"      "line"            "lineman"
#> [202] "liquidate"       "lockout"         "lot"
#> [205] "lump"            "lynch"           "march"
#> [208] "mark"            "martyr"          "martyrize"
#> [211] "maturation"      "maturity"        "maximum"
#> [214] "measure"         "meed"            "mess"
#> [217] "mete"            "modicum"         "moiety"
#> [220] "moira"           "morsel"          "nip"
#> [223] "object"          "objective"       "offscourings"
#> [226] "orts"            "outcome"         "outfield"
#> [229] "outfielder"      "paring"          "parings"
#> [232] "part"            "particle"        "parting"
#> [235] "pass"            "passing"         "payoff"
#> [238] "peak"            "percentage"      "perfect"
#> [241] "perfection"      "period"          "perish"
#> [244] "perishing"       "perorate"        "piece"
#> [247] "pinnacle"        "planets"         "player"
#> [250] "poison"          "poloist"         "portion"
#> [253] "prey"            "proportion"      "prove"
#> [256] "pugilist"        "purge"           "pursuit"
#> [259] "quantum"         "quarry"          "quarterback"
#> [262] "quietus"         "quintain"        "quit"
#> [265] "quota"           "racer"           "rags"
#> [268] "rake-off"        "rasher"          "ration"
#> [271] "reason"          "refrain"         "refuse"
#> [274] "release"         "relics"          "relinquish"
#> [277] "remainder"       "remains"         "remnant"
#> [280] "renounce"        "residue"         "residuum"
#> [283] "resolution"      "resolve"         "resolving"
#> [286] "rest"            "result"          "reward"
#> [289] "riddling"        "ripeness"        "roach"
#> [292] "rubbish"         "ruins"           "rump"
#> [295] "sacrifice"       "sawdust"         "scoop"
#> [298] "scourings"       "scrap"           "scraps"
#> [301] "scratch"         "scrub"           "segment"
#> [304] "shadow"          "shard"           "share"
#> [307] "shaving"         "shavings"        "shiver"
#> [310] "shred"           "skater"          "slaughter"
#> [313] "slay"            "sleep"           "slice"
#> [316] "sliver"          "smithereen"      "snack"
#> [319] "snatch"          "snip"            "snippet"
#> [322] "solution"        "solving"         "splinter"
#> [325] "sport"           "sportsman"       "stake"
#> [328] "stalemate"       "stand"           "standoff"
#> [331] "standstill"      "stars"           "start"
#> [334] "starve"          "stay"            "stitch"
#> [337] "stock"           "stop"            "stoppage"
#> [340] "straw"           "strike"          "stubble"
#> [343] "stump"           "succumb"         "summit"
#> [346] "survival"        "sweepings"       "tackle"
#> [349] "tailback"        "target"          "tatter"
#> [352] "teleology"       "term"            "terminal"
#> [355] "terminate"       "termination"     "terminus"
#> [358] "threshold"       "tip"             "to"
#> [361] "top"             "toxophilite"     "trace"
#> [364] "ultimate"        "unfold"          "unraveling"
#> [367] "unriddling"      "unscrambling"    "unspinning"
#> [370] "untangling"      "untwisting"      "unweaving"
#> [373] "upshot"          "utmost"          "uttermost"
#> [376] "vanish"          "vestige"         "walkout"
#> [379] "waste"           "weird"           "windup"
#> [382] "wingback"        "working"         "working-out"
#> [385] "wrestler"

## Code of Conduct

Please note that the ‘syn’ project is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.