小编vis*_*hnu的帖子

Google Cloud Speech API 返回“超出配额”

我的桌面 Python 应用程序转录大量语音样本(每个语音样本的持续时间在 1 秒到 8 秒之间),为此我使用 Google Cloud Speech API。我了解本页中提到的所有使用限制并且当然在限制范围内,以确保我不违反任何这些条件。

当我启动一组语音样本的应用程序时,它能够转录其中的一些样本,并在中间因以下错误而中断:

googleapiclient.errors.HttpError:
<HttpError 429 when requesting 
https://speech.googleapis.com/v1beta1/speech:syncrecognize?alt=json returned 
"Quota exceeded.">
Run Code Online (Sandbox Code Playgroud)

我在网上搜索了这个错误 ID,发现了这个,但我无法将它与我正在处理的错误具体联系起来。我还应该注意 Google Cloud Speech API 的任何其他限制吗?

任何帮助将不胜感激。

google-cloud-speech

5
推荐指数
1
解决办法
2463
查看次数

在另一个类声明中创建类的对象时出现“预期类型说明符”错误

我有一个名为scratch的类,并使用scratch.h来声明它。

现在我有另一个类称为scratch2scratch2.h,想从头开始创建一个对象作为共享指针

这是我在scratch2类声明中使用的语法:

std::shared_ptr<scratch> newObject(new scratch());
Run Code Online (Sandbox Code Playgroud)

但我收到此错误: Error: Expected type specifier

所以我尝试了这个:

std::shared_ptr<scratch> newObject2 = std::make_shared<scratch>();
Run Code Online (Sandbox Code Playgroud)

这工作正常。谁能告诉我为什么第一个不起作用?

我的scratch.h代码:

#ifndef _SCRATCH_
#define _SCRATCH_

#include <iostream>

class scratch {
private:
    int _a;
    float _b;
    std::string _s;
public:
    scratch();
    scratch(int a, float b, std::string n);
    ~scratch();
};
#endif
Run Code Online (Sandbox Code Playgroud)

和我的scratch2.h:

#ifndef _SCRATCH_2_
#define _SCRATCH_2_

#include "scratch.h"
#include <memory>

class scratch2 {
    std::shared_ptr<scratch> newObject(new scratch()); // Expected a type specifier error occurs here …
Run Code Online (Sandbox Code Playgroud)

c++ shared-ptr

1
推荐指数
1
解决办法
6843
查看次数

标签 统计

c++ ×1

google-cloud-speech ×1

shared-ptr ×1