GithubHelp home page GithubHelp logo

software-mansion-labs / elixir-ibm-speech-to-text Goto Github PK

View Code? Open in Web Editor NEW
8.0 3.0 0.0 711 KB

Elixir client library for IBM Cloud Speech to Text service

License: Apache License 2.0

Elixir 100.00%

elixir-ibm-speech-to-text's Introduction

IBM Cloud Speech to Text

Hex.pm CircleCI

Elixir client for IBM Cloud Speech to Text service

Installation

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

def deps do
  [
    {:ibm_speech_to_text, "~> 0.3"}
  ]
end

The docs can be found on hexdocs.pm

Usage

  1. Start the client process. For that you need to pass API URL or region as an atom, API key obtained from IBM Cloud console. start_link also accepts parameters for the endpoint, see the docs for more details.

    {:ok, pid} = IBMSpeechToText.Client.start_link(:frankfurt, "API_KEY", model: "en-GB_BroadbandModel")
  2. Send "start" event with configuration for speech recognition

    start_message = %IBMSpeechToText.Start{content_type: :flac}
    IBMSpeechToText.Client.send_message(pid, start_message)
  3. Start audio streaming

    IBMSpeechToText.Client.send_data(pid, audio_data)
  4. Stop streaming by sending "stop" message

    stop_message = %IBMSpeechToText.Stop{}
    IBMSpeechToText.Client.send_message(pid, stop_message)
  5. You will receive results via message with struct IBMSpeechToText.Response

    %IBMSpeechToText.Response{
      result_index: 0,
      results: [
        %IBMSpeechToText.RecognitionResult{
          alternatives: [
            %IBMSpeechToText.RecognitionAlternative{
              confidence: 0.87,
              timestamps: nil,
              transcript: "to Sherlock Holmes she's always the woman ",
              word_confidence: nil
            }
          ],
          final: true,
          keywords_result: nil,
          word_alternatives: nil
        }, ...
      ],
      speaker_labels: nil,
      warnings: nil
    }

Testing

Test tagged :external is excluded by default since it contacts the real API and requires an API key provided via config. This can be done by adding config/test.secret.exs file with the following content:

use Mix.Config

config :ibm_speech_to_text, api_key: "YOUR_API_KEY"

Fixture

A recording fragment in test/fixtures comes from an audiobook "The adventures of Sherlock Holmes (version 2)" available on LibriVox

Status

There are a few things that are not implemented in current version:

  • parsing "word_alternatives" and "keywords_result" in RecognitionResult
  • better way to pass endpoint options to client

Copyright and License

Copyright 2019, Software Mansion

Software Mansion

Licensed under the Apache License, Version 2.0

elixir-ibm-speech-to-text's People

Contributors

bblaszkow06 avatar mat-hek avatar mspanc avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  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.