0

そのため、現在、クラウド関数を介して NLP API にテキストを送信する拡張機能があります。このテキストが処理および予測され、その予測に基づいてスコアが割り当てられます (たとえば、文は 0.33 - 「重要な同意」となる可能性があります)。文章をそれぞれのスコアとともに Firestore に保存できるかどうか疑問に思っています。現在、文章は保存できますが、スコアは保存できません。

使用しているしきい値の制限のため、Firestore DB にスコアが必要です。スコアがない場合、しきい値は無効になります。

念のため、クラウド関数を次に示します。

  exports.queryAutoML = (req, res) => {

  const automl = require('@google-cloud/automl');

  const client = new automl.PredictionServiceClient();

  var formattedName = client.modelPath('*********', '**********', '*****************');
  var payload = {
    "textSnippet": {
       "content": req.body,
        "mime_type": "text/plain"
    },
  };
  var request = {
    name: formattedName,
    payload: payload,
  };
  client.predict(request)
    .then(responses => {
    console.log("in success");
    let title = responses[0].payload[0].displayName;
    let score = responses[0].payload[0].classification.score;
    output = [req.body, title, score];
    res.status(200).send(output);
  })
    .catch(err => {
    console.log("in error");
    console.error(err);
  });
4

1 に答える 1