如何偵測和修訂個人識別資訊 (PII)

PII 功能可以在數 個預先定義的類別中評估非結構化文字、擷取和修訂敏感性資訊 (PII) 和健康情況資訊 (PHI)。

開發選項

若要使用 PII 偵測,您可以提交文字以進行分析並處理應用程式中的 API 輸出。 分析是按原樣執行,對針對您的資料所使用的模型不會進行自訂。 有兩種使用 PII 偵測的方式:

開發選項 描述
Language Studio Language Studio 是以 Web 為基礎的平台,可讓您在沒有 Azure 帳戶的情況下嘗試使用文字範例進行實體連結,以及在註冊時使用自己的資料。 如需詳細資訊,請參閱 Language Studio 網站Language Studio 快速入門
REST API 或用戶端連結庫 (Azure SDK) 使用 REST API 或以各種語言提供的用戶端程式庫,將 PII 偵測整合至您的應用程式。 如需詳細資訊,請參閱 PII 偵測快速入門

決定如何處理資料(選擇性)

指定 PII 偵測模型

根據預設,這項功能會在您的文字上使用最新的可用 AI 模型。 您也可以將 API 要求設定為使用特定 模型版本

輸入語言

當您提交要處理的檔時,您可以指定所撰寫的支持語言如果您未指定語言,則擷取預設為英文。 API 可能會傳回回應中的位移,以支援不同的 多語系和表情符號編碼

提交數據

在收到要求時,會執行分析。 同步使用 PII 偵測功能是無狀態的。 您的帳戶中不會儲存任何數據,而且會在回應中立即傳回結果。

以異步方式使用這項功能時,API 結果會在擷取要求之後的24小時內取得,並在回應中指出。 在此期間之後,系統會清除結果,且無法再進行擷取。

選取要傳回的實體

API 會嘗試偵測 指定文件語言的已定義實體類別 。 如果您想要指定要偵測並傳回哪些實體,請使用選擇性 piiCategories 參數搭配適當的實體類別。 此參數也可以讓您偵測文件語言預設未啟用的實體。 下列範例只會 Person偵測 。 您可以指定要傳回的一或多個 實體類型

提示

如果您未在指定實體類別時包含 default ,API 只會傳回您指定的實體類別。

輸入:

注意

在此範例中,它只會傳 回人員 實體類型:

https://<your-language-resource-endpoint>/language/:analyze-text?api-version=2022-05-01

{
    "kind": "PiiEntityRecognition",
    "parameters": 
    {
        "modelVersion": "latest",
        "piiCategories" :
        [
            "Person"
        ]
    },
    "analysisInput":
    {
        "documents":
        [
            {
                "id":"1",
                "language": "en",
                "text": "We went to Contoso foodplace located at downtown Seattle last week for a dinner party, and we adore the spot! They provide marvelous food and they have a great menu. The chief cook happens to be the owner (I think his name is John Doe) and he is super nice, coming out of the kitchen and greeted us all. We enjoyed very much dining in the place! The pasta I ordered was tender and juicy, and the place was impeccably clean. You can even pre-order from their online menu at www.contosofoodplace.com, call 112-555-0176 or send email to order@contosofoodplace.com! The only complaint I have is the food didn't come fast enough. Overall I highly recommend it!"
            }
        ]
    }
}

輸出:


{
    "kind": "PiiEntityRecognitionResults",
    "results": {
        "documents": [
            {
                "redactedText": "We went to Contoso foodplace located at downtown Seattle last week for a dinner party, and we adore the spot! They provide marvelous food and they have a great menu. The chief cook happens to be the owner (I think his name is ********) and he is super nice, coming out of the kitchen and greeted us all. We enjoyed very much dining in the place! The pasta I ordered was tender and juicy, and the place was impeccably clean. You can even pre-order from their online menu at www.contosofoodplace.com, call 112-555-0176 or send email to order@contosofoodplace.com! The only complaint I have is the food didn't come fast enough. Overall I highly recommend it!",
                "id": "1",
                "entities": [
                    {
                        "text": "John Doe",
                        "category": "Person",
                        "offset": 226,
                        "length": 8,
                        "confidenceScore": 0.98
                    }
                ],
                "warnings": []
            }
        ],
        "errors": [],
        "modelVersion": "2021-01-15"
    }
}

取得 PII 結果

當您從 PII 偵測取得結果時,您可以將結果串流至應用程式,或將輸出儲存到本機系統上的檔案。 API 回應會包含 已辨識的實體,包括其類別和子類別,以及信賴分數。 也會傳回具有 PII 實體的文字字串。

服務和數據限制

如需您可以每秒傳送的要求大小和數目的相關信息,請參閱 服務限制 一文。

下一步

具名實體辨識概觀