GithubHelp home page GithubHelp logo

slykempt / php-speech-to-text Goto Github PK

View Code? Open in Web Editor NEW

This project forked from rogerthomas84/php-speech-to-text

0.0 1.0 0.0 170 KB

PHP implementation of the Google Speech to Text API

PHP 100.00%

php-speech-to-text's Introduction

PHP Speech To Text

About

This is an example file to demonstrate how to interact with the Google Speech API.

Getting Started

Visit: https://code.google.com/apis/console/ Enable the Speech API listed on the page.

Don't see Speech API?

That's a fairly common thing. It seems that only developers on the chromium-dev list actually can see it listed.

Don't worry. Go to: http://groups.google.com/a/chromium.org/group/chromium-dev/topics

Now, sign up for the list.

Go back to the API Console and refresh the page. You'll see it listed.

Usage

See the sample/example.php file, or use this below:

<?php
include 'GoogleSpeechToText.php';

// Your API Key goes here.
$apiKey = '';
$speech = new GoogleSpeechToText($apiKey);
$file = realpath(__DIR__ . '/quick.flac'); // Full path to the file.
$bitRate = 44100; // The bit rate of the file.
$result = $speech->process($file, $bitRate, 'en-US');
var_dump($result);

Running the example file outputs:

array(1) {
  [0]=>
  array(2) {
    ["alternative"]=>
    array(5) {
      [0]=>
      array(2) {
        ["transcript"]=>
        string(44) "the quick brown fox jumped over the lazy dog"
        ["confidence"]=>
        float(0.87096781)
      }
      [1]=>
      array(1) {
        ["transcript"]=>
        string(43) "the quick brown fox jumps over the lazy dog"
      }
      [2]=>
      array(1) {
        ["transcript"]=>
        string(49) "the quick brown fox jumped over the lazy dog cafe"
      }
      [3]=>
      array(1) {
        ["transcript"]=>
        string(49) "the quick brown fox jumped over the lazy dog food"
      }
      [4]=>
      array(1) {
        ["transcript"]=>
        string(47) "the quick brown fox jumped over the lazy dog hi"
      }
    }
    ["final"]=>
    bool(true)
  }
}

php-speech-to-text's People

Contributors

rogerthomas84 avatar

Watchers

 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.