/datamuse-swift

A datamuse api swift wrapper without dependencies

Primary LanguageSwiftMIT LicenseMIT

datamuse-swift

Platforms License Swift Package Manager CocoaPods compatible Carthage compatible Travis

logo

A datamuse api swift wrapper without dependencies

Requirements

  • iOS 9.3+ / Mac OS X 10.10+ / tvOS 9.0+ / watchOS 4.0+
  • Xcode 9.0+

Installation

CocoaPods

CocoaPods is a dependency manager for Cocoa projects. You can install it with the following command:

$ gem install cocoapods

To integrate datamuse-swift into your Xcode project using CocoaPods, specify it in your Podfile:

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '9.3'
use_frameworks!

pod 'datamuse-swift', '~> 0.0.5'

Then, run the following command:

$ pod install

Carthage

Carthage is a decentralized dependency manager that automates the process of adding frameworks to your Cocoa application.

You can install Carthage with Homebrew using the following command:

$ brew update
$ brew install carthage

To integrate datamuse-swift into your Xcode project using Carthage, specify it in your Cartfile:

github "datamuse-swift/datamuse-swift" ~> 0.0.1

Swift Package Manager

To use datamuse-swift as a Swift Package Manager package just add the following in your Package.swift file.

import PackageDescription

let package = Package(
    name: "Hellodatamuse-swift",
    dependencies: [
        .Package(url: "https://github.com/ezefranca/datamuse-swift.git", "0.0.1")
    ]
)

Manually

If you prefer not to use either of the aforementioned dependency managers, you can integrate datamuse-swift into your project manually. Just copy the Core folder to your project.

Usage

You just need a instace of DataMuseClient and can start yours calls.

let client = DataMuseClient()

All calls returns a [Words]. The Words are a struct with the score result of API and the word string:

public struct Words : Codable {
    public let word : String?
    public let score : Int?
}

List with all methods:

  • words with a meaning similar to ringing in the ears
public func wordMeaningSimilar(to: String, completion: @escaping ([Words]?, NSError?) -> Void)
  • words related to duck that start with the letter b
public func wordRelated(to: String, startedWith: String, completion: @escaping ([Words]?, NSError?) -> Void)
  • words related to spoon that end with the letter a
public func wordRelated(to: String, finishedWith: String, completion: @escaping ([Words]?, NSError?) -> Void)
  • words that sound like elefint
public func wordSoundsLike(to: String, completion: @escaping ([Words]?, NSError?) -> Void)
  • words that start with t, end in k, and have two letters in between
public func word(start: String, finish: String, numberofLettersBetween: Int, completion: @escaping ([Words]?, NSError?) -> Void)
  • words that are spelled similarly to coneticut
public func wordsSpelledSimilarly(to: String, completion: @escaping ([Words]?, NSError?) -> Void)
  • words that rhyme with forgetful
public func wordsThatRhyme(with: String, completion: @escaping ([Words]?, NSError?) -> Void)
  • words that rhyme with grape that are related to breakfast
public func wordsThatRhyme(with: String, related: String, completion: @escaping ([Words]?, NSError?) -> Void)
  • adjectives that are often used to describe ocean
public func adjectivesThatAreOften(to: String, completion: @escaping ([Words]?, NSError?) -> Void)
  • adjectives describing ocean sorted by how related they are to temperature
public func adjectivesThatDescribing(this: String, related: String, completion: @escaping ([Words]?, NSError?) -> Void)
  • nouns that are often described by the adjective yellow
public func nounsThatAreOftenDescribed(by: String, completion: @escaping ([Words]?, NSError?) -> Void)
  • words that often follow "drink" in a sentence, that start with the letter w
public func wordThatOften(follow: String, start: String, completion: @escaping ([Words]?, NSError?) -> Void)
  • words that are triggered by (strongly associated with) the word "cow"
public func wordsThatAreTriggered(by: String, completion: @escaping ([Words]?, NSError?) -> Void)
  • suggestions for the user if they have typed in rawand so far
public func suggestionsBased(into: String, completion: @escaping ([Words]?, NSError?) -> Void)

License

datamuse-swift is released under the MIT license. See LICENSE for details.