2017-08-16 46 views

回答

0

我發現要在您的nodejs中使用@ google-cloud/speech模塊,您必須在Google雲端平臺上創建一個項目,並且需要登錄到您的Google帳戶並提供您的投影作爲參數演講構造函數才能成功登錄。

const speechClient = Speech({ 
    projectId: projectId 
}); 

這會驗證您撥打Google語音API的電話。我沒有找到能夠使用Google API密鑰進行驗證的文檔。

1

您需要服務帳戶密鑰(它是JSON密鑰文件)。轉到

Google speech api dashboard -> credentials -> create credentials 
-> Service account key -> Compute engine default -> download json file. 

最後將它添加到配置的密鑰文件,例如:

{ 
    projectId: 'my-project', 
    keyFile: './myKeyFile.json' 
}; 

來源: https://bloggerbrothers.com/2017/01/15/the-complete-guide-to-enabling-speech-recognition-on-an-rpi3-in-nodejs/

+0

感謝。有用。 – user3815252