google speech api 호출(Google 음성 인식 엔진 사용)

4182 단어 Google
완전 참조:
http://mikepultz.com/2011/03/accessing-google-speech-api-chrome-11/
http://aiku.me/bar/10448042
첨부:http://src.chromium.org/viewvc/chrome/trunk/src/content/browser/speech/
 
curl 명령 행
curl -H "Content-Type: audio/x-flac; rate=8000" "https://www.google.com/speech-api/v1/recognize?xjerr=1&client=chromium&lang=en-US" -F myfile="@org.flac" -k -o 'org_xx.txt'

 
wget 명령 행
wget -O 'org_xx.txt' --user-agent="Mozilla/5.0" --post-file=org.flac --header="Content-Type: audio/x-flac; rate=8000" "http://www.google.com/speech-api/v1/recognize?xjerr=1&client=chromium&lang=en-US"

 
perl 스 크 립 트  myspeech
 1 #! /usr/bin/perl

 2 require LWP::UserAgent;

 3 

 4 my $url = "https://www.google.com/speech-api/v1/recognize?xjerr=1&client=chromium&lang=en-US";

 5 my $audio = "";

 6 

 7 open(FILE, "<" . $ARGV[0]);

 8 while(<FILE>)

 9 {

10      $audio .= $_;

11 }

12 close(FILE);

13 

14 my $ua = LWP::UserAgent->new;

15 

16 my $response = $ua->post($url, Content_Type => "audio/x-flac; rate=8000", Content => $audio);

17 

18 if ($response->is_success)

19 {

20      print $response->content;

21 }

운행 방식  ./myspeech  org.flac

좋은 웹페이지 즐겨찾기