Skip to content
This repository has been archived by the owner on Nov 8, 2023. It is now read-only.

preciz/datamusex

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

53 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Datamusex

API wrapper for the free Datamuse API.

Installation

The package can be installed by adding datamusex to your list of dependencies in mix.exs:

def deps do
  [
    {:datamusex, "~> 0.4"}
  ]
end

Usage

iex> Datamusex.similar_meaning("donut")
%Datamusex.ParamList{
  params: [%Datamusex.Param{name: :similar_meaning, value: "donut"}]
}

iex> Datamusex.similar_meaning("computer") |> Datamusex.triggered_by("device") |> Datamusex.get_words()
{:ok,
 %HTTPoison.Response{
    body: [
         %{"score" => 1318, "word" => "tablet"},
         ...

iex> Datamusex.similar_meaning("donut") |> Datamusex.triggered_by("torus") |> Datamusex.get_words()
{:ok,
 %HTTPoison.Response{
    body: [
         %{"score" => 1799, "word" => "toroid"},
         ...


Datamusex.get_suggestions("car")

API wrapper functions

Execute the paramlist created by these functions with get_words/3:

similar_meaning/2
sound_like/2
spelled_similarly/2
rhyme_with/2
used_to_describe/2
often_follow/2
triggered_by/2
synonyme/2

Autocomplete suggestions:

get_suggestions/3