All Projects → innFactory → React Native Dialogflow

innFactory / React Native Dialogflow

Licence: mit
A React-Native Bridge for the Google Dialogflow (API.AI) SDK

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to React Native Dialogflow

Pysptk
A python wrapper for Speech Signal Processing Toolkit (SPTK).
Stars: ✭ 297 (+63.19%)
Mutual labels:  speech, speech-processing
Speech Emotion Analyzer
The neural network model is capable of detecting five different male/female emotions from audio speeches. (Deep Learning, NLP, Python)
Stars: ✭ 633 (+247.8%)
Mutual labels:  speech, voice
Pocketsphinx Python
Python interface to CMU Sphinxbase and Pocketsphinx libraries
Stars: ✭ 298 (+63.74%)
Mutual labels:  speech, voice
spokestack-android
Extensible Android mobile voice framework: wakeword, ASR, NLU, and TTS. Easily add voice to any Android app!
Stars: ✭ 52 (-71.43%)
Mutual labels:  voice, speech
Tfg Voice Conversion
Deep Learning-based Voice Conversion system
Stars: ✭ 115 (-36.81%)
Mutual labels:  speech, speech-processing
hifigan-denoiser
HiFi-GAN: High Fidelity Denoising and Dereverberation Based on Speech Deep Features in Adversarial Networks
Stars: ✭ 88 (-51.65%)
Mutual labels:  speech, speech-processing
Speech Denoising Wavenet
A neural network for end-to-end speech denoising
Stars: ✭ 516 (+183.52%)
Mutual labels:  speech, speech-processing
web-speech-demo
Learn how to build a simple text-to-speech voice app for the web using the Web Speech API.
Stars: ✭ 19 (-89.56%)
Mutual labels:  voice, speech
Voicer
AGI-server voice recognizer for #Asterisk
Stars: ✭ 73 (-59.89%)
Mutual labels:  google, voice
Mlkit
A collection of sample apps to demonstrate how to use Google's ML Kit APIs on Android and iOS
Stars: ✭ 949 (+421.43%)
Mutual labels:  google, text-recognition
LIUM
Scripts for LIUM SpkDiarization tools
Stars: ✭ 28 (-84.62%)
Mutual labels:  speech, speech-processing
Wavenet vocoder
WaveNet vocoder
Stars: ✭ 1,926 (+958.24%)
Mutual labels:  speech, speech-processing
ttslearn
ttslearn: Library for Pythonで学ぶ音声合成 (Text-to-speech with Python)
Stars: ✭ 158 (-13.19%)
Mutual labels:  speech, speech-processing
Neural Voice Cloning With Few Samples
This repository has implementation for "Neural Voice Cloning With Few Samples"
Stars: ✭ 262 (+43.96%)
Mutual labels:  speech-processing, voice
UniSpeech
UniSpeech - Large Scale Self-Supervised Learning for Speech
Stars: ✭ 224 (+23.08%)
Mutual labels:  speech, speech-processing
Java Speech Api
The J.A.R.V.I.S. Speech API is designed to be simple and efficient, using the speech engines created by Google to provide functionality for parts of the API. Essentially, it is an API written in Java, including a recognizer, synthesizer, and a microphone capture utility. The project uses Google services for the synthesizer and recognizer. While this requires an Internet connection, it provides a complete, modern, and fully functional speech API in Java.
Stars: ✭ 490 (+169.23%)
Mutual labels:  google, speech
voice-based-email-for-blind
Emailing System for visually impaired persons
Stars: ✭ 35 (-80.77%)
Mutual labels:  voice, speech
VAD-LTSD
Efficient voice activity detection algorithm using long-term speech information
Stars: ✭ 37 (-79.67%)
Mutual labels:  voice, speech
Annyang
💬 Speech recognition for your site
Stars: ✭ 6,216 (+3315.38%)
Mutual labels:  speech, voice
Avpi
an open source voice command macro software
Stars: ✭ 130 (-28.57%)
Mutual labels:  speech, voice

react-native-dialogflow (react-native-api-ai)

Build Status Version Downloads

A React-Native Bridge for the Google Dialogflow AI SDK.

Header Image

Support for iOS 10+ and Android!

Dialogflow is a powerful tool for building delightful and natural conversational experiences. You can build chat and speech bots and may intergrate it in a lot of platform like twitter, facebook, slack, or alexa.

Install

This package depends on react-native-voice, follow their readme to setup it.

Add react-native-dialogflow and link it:

npm install --save react-native-dialogflow react-native-voice

react-native link react-native-dialogflow
react-native link react-native-voice

iOS: IMPORTANT xCode plist settings

Also, you need open the React Native xCode project and add two new keys into Info.plist Just right click on Info.plist -> Open As -> Source Code and paste these strings somewhere into root <dict> tag

<key>NSSpeechRecognitionUsageDescription</key>
<string>Your usage description here</string>
<key>NSMicrophoneUsageDescription</key>
<string>Your usage description here</string>

Application will crash if you don't do this.

Usage

Import Dialogflow:

import Dialogflow from "react-native-dialogflow";

or for V2

import { Dialogflow_V2 } from "react-native-dialogflow"

Configuration

Set the accessToken and the language in your constructor:

 constructor(props) {
        super(props);

        Dialogflow.setConfiguration(
          "4xxxxxxxe90xxxxxxxxc372", Dialogflow.LANG_GERMAN
        );
    }

For V2 you can set the client_email and private_key of the credential json auth setup. In addition you have to set your projectId:

 constructor(props) {
        super(props);

        Dialogflow_V2.setConfiguration(
            "your-[email protected]",
            '-----BEGIN PRIVATE KEY-----\nMIIEvgIBADAN...1oqO\n-----END PRIVATE KEY-----\n',
            Dialogflow_V2.LANG_GERMAN,
            'testv2-3b5ca'
        );
    }

Listening

Start listening with integrated speech recognition:

   <Button onPress={() => {
            Dialogflow.startListening(result=>{
                console.log(result);
            }, error=>{
                console.log(error);
            });
        }}
   />

In iOS only you have to call finishListening(). Android detects the end of your speech automatically. That's the reason why we didn't implement the finish method in Android.

// only for iOS
Dialogflow.finishListening();
// after this call your callbacks from the startListening will be executed.

Text Request

For using your own speech recognition:

   <Button onPress={() => {
           Dialogflow.requestQuery("Some text for your Dialogflow agent", result=>console.log(result), error=>console.log(error));
        }}
   />

Request an Event

For sending an event to Dialogflow (Contexts and Entities have no effect!):

Dialogflow.requestEvent(
    "WELCOME",
    {param1: "yo mr. white!"},
    result=>{console.log(result);},
    error=>{console.log(error);}
);

Contexts

Set contexts (will take affect on next startListening or queryRequest):

const contexts = [{
  name: "deals",
  lifespan: 1,
  parameters: {
      Shop: "Rewe"
  }
}];

Dialogflow.setContexts(contexts);

Reset all (non-permantent) contexts for current session:

Dialogflow.resetContexts(result=>{
       console.log(result);
    }, error=>{
       console.log(error);
    });

Set permanent contexts, which will be set automatically before every request. This is useful for e.g. access tokens in webhooks:

const permanentContexts = [{
  name: "Auth",
  // lifespan 1 is set automatically, but it's overrideable
  parameters: {
      AccessToken: "1234yo1234"
  }
}];

Dialogflow.setPermanentContexts(permanentContexts);

Entities

Set UserEntities (will take affect on next startListening or queryRequest):

const entities = [{
  "name":"shop",
  "extend":true,
  "entries":[
      {
          "value":"Media Markt",
          "synonyms":["Media Markt"]
      }
  ]
 }];

 Dialogflow.setEntities(entities);

Listener for Android

Only in Android we have four additional methods: onListeningStarted, onListeningCanceled, onListeningFinished and onAudioLevel. In iOS they will be never called:

   <Button onPress={() => {

            Dialogflow.onListeningStarted(()=>{
                console.log("listening started");
            });

            Dialogflow.onListeningCanceled(()=>{
                console.log("listening canceled");
            });

            Dialogflow.onListeningFinished(()=>{
                console.log("listening finished");
            });

            Dialogflow.onAudioLevel(level=>{
                console.log(level);
            });


            Dialogflow.startListening(result=>{
                console.log(result);
            }, error=>{
                console.log(error);
            });
        }}
   />

Note: Make sure you are setting the callbacks before startListening every single time again. Don't set the callbacks in e.g. constructor or componentsDidMount if you are executing startListening more than one times.

Supported Languages

Set the language in your configuration:

Dialogflow.setConfiguration("4xxxxxxxe90xxxxxxxxc372", Dialogflow.LANG_GERMAN);
  • LANG_CHINESE_CHINA
  • LANG_CHINESE_HONGKONG
  • LANG_CHINESE_TAIWAN
  • LANG_DUTCH
  • LANG_ENGLISH
  • LANG_ENGLISH_GB
  • LANG_ENGLISH_US
  • LANG_FRENCH
  • LANG_GERMAN
  • LANG_ITALIAN
  • LANG_JAPANESE
  • LANG_KOREAN
  • LANG_PORTUGUESE
  • LANG_PORTUGUESE_BRAZIL
  • LANG_RUSSIAN
  • LANG_SPANISH
  • LANG_UKRAINIAN

Methods

name platform param1 param2 param3 param4
setConfiguration (V1) both accessToken: String languageTag: String
setConfiguration (V2) both client_email: String private_key: String languageTag: String projectId: String
startListening both resultCallback: (result: object)=>{} errorCallback: (error: object)=>{}
finishListening ios
requestQuery both query: String resultCallback: (result: object)=>{} errorCallback: (error: object)=>{}
requestEvent both eventName: String eventData: Object resultCallback: (result: object)=>{} errorCallback: (error: object)=>{}
onListeningStarted both callback: ()=>{}
onListeningCanceled none callback: ()=>{}
onListeningFinished both callback: ()=>{}
onAudioLevel android callback: (level: number)=>{}
setContexts both array
resetContexts both resultCallback: (result: object)=>{} errorCallback: (error: object)=>{}
setPermanentContexts both array
setEntities (V1 only) both array

Blogpost

Deutsch

Sprachsteuerung mit Api.ai in einer React-Native App

English

Contributors

Powered by innFactory

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].