GithubHelp home page GithubHelp logo

nhunghuynhthihong / api-ai-cocoa-swift Goto Github PK

View Code? Open in Web Editor NEW

This project forked from dialogflow/api-ai-cocoa-swift

0.0 2.0 0.0 87 KB

Cocoa Swift library

License: Apache License 2.0

Ruby 1.31% Objective-C 0.85% Swift 97.84%

api-ai-cocoa-swift's Introduction

Cocoa SDK for api.ai

Build Status Version License Platform Carthage Compatible


Overview

The API.AI iOS SDK makes it easy to integrate natural language processing API on Apple devices. API.AI allows using voice commands and integration with dialog scenarios defined for a particular agent in API.AI.

Prerequsites

Running the Demo app (CocoaPods supports only)

  • Run pod update in the AIDemo project folder.

  • Open AIDemo.xworkspace in Xcode.

  • In AppDelegate insert API key.

    AI.configure("YOUR_CLIENT_ACCESS_TOKEN")
    

    Note: an agent in api.ai should exist. Keys could be obtained on the agent's settings page.

  • Define sample intents in the agent.

  • Run the app in Xcode. Inputs are possible with text and voice (experimental).

Integrating into your app

CocoaPods

CocoaPods is a dependency manager for Swift and Objective-C Cocoa projects. Installing:

$ [sudo] gem install cocoapods

List "AI" in a text file named Podfile in your Xcode project directory:

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

target '<Your Target Name>' do
    pod 'AI', '~> 0.7'
end

Now you can install the dependencies in your project:

$ pod install

Carthage

Carthage is intended to be the simplest way to add frameworks to your Cocoa application.

You can use Homebrew and install the carthage tool on your system simply by running brew update and brew install carthage.

Create a Cartfile with following text:

github "api-ai/AI"

Run carthage update. Drag the built AI.framework into your Xcode project.

Init the SDK.

In the AppDelegate.swift, add AI import:

import AI

In the AppDelegate.swift, add

// Define API.AI configuration here.
AI.configure("YOUR_CLIENT_ACCESS_TOKEN")

Perform request.

...
// Request using text (assumes that speech recognition / ASR
// is done using a third-party library, e.g. AT&T)
AI.sharedService.TextRequest("Hello").success { (response) -> Void in
    // Handle success ...
}.failure { (error) -> Void in
    // Handle error ...
}

api-ai-cocoa-swift's People

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.