Analyze Toxicity with Perspective API
Made by Jigsaw
Analyze the perceived impact a comment might have on a conversation using Perspective API.
この拡張機能の動作
Use this extension to get toxicity scores from Perspective API for comments written to a Cloud Firestore collection.
This extension runs Perspective API on the text field and collection you configure. The API uses machine learning models to score the perceived impact a comment might have on a conversation by evaluating that comment across a range of emotional concepts, called attributes. When you install this extension, you will specify the attributes you want to receive scores for. Perspective's main attribute is TOXICITY, defined as "a rude, disrespectful, or unreasonable comment that is likely to make you leave a discussion". See a list of all available attributes on our developer site. Scores are retrieved when a new document is added to your collection or an existing document is modified.
Additional setup
Before you can use this extension, you will need to enable Perspective API. Follow the instructions on our Get Started page to request API access and then enable the API and create an API key .
By default, you're granted quota for 1 query per second (QPS) to Perspective API. For additional QPS, fill out a quota increase request as needed.
Note: If you add or update documents at a rate higher than your allotted QPS, you may exceed quota and the extension will fail to score your documents.
Billing
Perspective API is free for all amounts of quota. However, the extension uses Firebase and Google Cloud Platform services which may have associated charges, including:
- Cloud Firestore
- Cloud Functions
When you use Firebase Extensions, you're only charged for the underlying resources that you use. A paid-tier billing plan is only required if the extension uses a service that requires a paid-tier plan, for example calling to a Google Cloud API or making outbound network requests to non-Google services. All Firebase services offer a free tier of usage. Learn more about Firebase billing.
この拡張機能をインストールする方法
Firebase CLI の使用
拡張機能のインストールと管理は、Firebase CLI でも行えます。
ステップ 1: 以下の npm コマンドを実行して、CLI をインストールするか、最新バージョンの CLI に更新します。
npm install -g firebase-tools正常に機能しない場合は、 Firebase CLI リファレンス を確認するか、 npm のアクセス権 を変更してください。
ステップ 2: 新しい Firebase プロジェクトのディレクトリを設定 するか、既存のプロジェクト ディレクトリに移動します
ステップ 3: 次を実行して、この拡張機能を 拡張機能のマニフェスト に追加します
firebase ext:install jigsaw/firestore-perspective-toxicity --local --project=projectId_or_alias
ステップ 4(任意): Firebase Emulator Suite を使用して、この拡張機能をローカルでテストします
firebase emulators:start
ステップ 5: マニフェストにある拡張機能をプロジェクトに デプロイ します
firebase deploy --only extensions --project=projectId_or_alias