Code Monkey home page Code Monkey logo

azure_speech_assessment_old's Introduction

AzureSpeechRecognition

See original project by cristianbregant: https://github.com/cristianbregant/azure_speech_recognition

Getting Started

This project is a starting point for using the Azure Speech Recognition Services.

To use this plugin you must have already created an account on the cognitive service page.

Installation

To install the package use the latest version:

azure_speech_recognition: ^0.8.5

Usage

import 'package:azure_speech_recognition_null_safety/azure_speech_recognition_null_safety.dart';

Initialize

There are 2 type of initializer:

Simple initializer

It should be used in any case other than the IntentRecognition. The language default setting is "en-EN" but you could use what you want (if it is supported). The segmentation silence timeout default is 1000 ms. (It must be an integer in the range 100 to 5000)

AzureSpeechRecognition.initialize("your_subscription_key", "your_server_region",lang: "it-IT", timeout: "3000");

Intent initializer

It should be used only in IntentRecognition. The language default setting is "en-EN" but you could use what you want (if it is supported).

AzureSpeechRecognition.initializeLanguageUnderstading("your_language_subscription_key", "your_language_server_region", "your_language_appId",lang:"it-IT");

Types of recognitions

Simple voice recognition (Android and iOS supported)

The response is given at the end of the recognition.

AzureSpeechRecognition _speechAzure;
String subKey = "your_key";
String region = "your_server_region";
String lang = "it-IT";

void activateSpeechRecognizer(){
    // MANDATORY INITIALIZATION
  AzureSpeechRecognition.initialize(subKey, region,lang: lang);
  
  _speechAzure.setFinalTranscription((text) {
    // do what you want with your final transcription
  });

  _speechAzure.setRecognitionStartedHandler(() {
   // called at the start of recognition (it could also not be used)
  });

}

  @override
  void initState() {
    
    _speechAzure = new AzureSpeechRecognition();

    activateSpeechRecognizer();

    super.initState();
  }



Future recognizeVoice() async {
    try {
      AzureSpeechRecognition.simpleVoiceRecognition();
    } on PlatformException catch (e) {
      print("Failed start the recognition: '${e.message}'.");
    }
  }

Voice recognition with microphone streaming

It returns in the recognitionResultHandler the temporary phrases that it understand and at the end the final response is returned by the setFinalTranscription method.

void activateSpeechRecognizer(){
    // MANDATORY INITIALIZATION
  AzureSpeechRecognition.initialize(subKey, region,lang: lang);
  
  _speechAzure.setFinalTranscription((text) {
    // do what you want with your final transcription
  });

  _speechAzure.setRecognitionResultHandler((text) {
    // do what you want with your partial transcription (this one is called every time a word is recognized)
    // if you have a string that is displayed you could call here setState() to updated with the partial result
  });

  _speechAzure.setRecognitionStartedHandler(() {
   // called at the start of recognition (it could also not be used)
  });

}


Future recognizeVoiceMicStreaming() async {
    try {
      AzureSpeechRecognition.micStream();
    } on PlatformException catch (e) {
      print("Failed start the recognition: '${e.message}'.");
    }
  }

Voice recognition continuously : CURRENTLY NOT WORKING

It returns in the recognitionResultHandler the temporary phrases that it understand and at when the function is called again the final response is returned by the setFinalTranscription method.

Voice intent recognition

It returns in the recognitionResultHandler the temporary phrases that it understand and at the end the final response is returned by the setFinalTranscription method.

void activateSpeechRecognizer(){
    // MANDATORY INITIALIZATION
  AzureSpeechRecognition.initializeLanguageUnderstading(subKey, region, appId, lang: lang);
  
  _speechAzure.setFinalTranscription((text) {
    // do what you want with your final transcription
  });

  _speechAzure.setRecognitionResultHandler((text) {
    // do what you want with your partial transcription (this one is called every time a word is recognized)
    // if you have a string that is displayed you could call here setState() to updated with the partial result
  });

  _speechAzure.setRecognitionStartedHandler(() {
   // called at the start of recognition (it could also not be used)
  });

}


Future speechIntentRecognizer() async {
    try {
      AzureSpeechRecognition.intentRecognizer();
    } on PlatformException catch (e) {
      print("Failed start the recognition: '${e.message}'.");
    }
  }

Voice recognition with keyword : CURRENTLY NOT WORKING

This method require the keywords file to be put in the asset folder. The mandatory parameter is the name of that file. It returns in the recognitionResultHandler the temporary phrases that it understand and at the end the final response is returned by the setFinalTranscription method.

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

azure_speech_assessment_old's People

Contributors

jjordanoc avatar qianyukun avatar cristianbregant avatar marifdev 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.