Azure 表单识别器 Name/Value 对

Azure Form Recognizer Name/Value Pairs

我目前正在使用 Azure 表单识别器并有一个问题。我正在使用

https://<>.cognitiveservices.azure.com/formrecognizer/v2.0-preview/layout/analyzeResults/2e0a2322-65bb-4fd2-a3bf-98f70b36641e

JSON returned 似乎在使用基本的 OCR。我想知道它是否可能(容易)

接受这个

{
                    "boundingBox": [
                        4.4033,
                        1.5114,
                        6.5483,
                        1.5114,
                        6.5483,
                        1.6407,
                        4.4033,
                        1.6407
                    ],
                    "text": "Invoice For: First Up Consultants",
                    "words": [
                        {
                            "boundingBox": [
                                4.4033,
                                1.5143,
                                4.8234,
                                1.5143,
                                4.8234,
                                1.6155,
                                4.4033,
                                1.6155
                            ],
                            "text": "Invoice",
                            "confidence": 1
                        },
                        {
                            "boundingBox": [
                                4.8793,
                                1.5143,
                                5.1013,
                                1.5143,
                                5.1013,
                                1.6154,
                                4.8793,
                                1.6154
                            ],
                            "text": "For:",
                            "confidence": 1
                        },
                        {
                            "boundingBox": [
                                5.2048,
                                1.5130,
                                5.4927,
                                1.5130,
                                5.4927,
                                1.6151,
                                5.2048,
                                1.6151
                            ],
                            "text": "First",
                            "confidence": 1
                        },
                        {
                            "boundingBox": [
                                5.5427,
                                1.5130,
                                5.7120,
                                1.5130,
                                5.7120,
                                1.6407,
                                5.5427,
                                1.6407
                            ],
                            "text": "Up",
                            "confidence": 1
                        },
                        {
                            "boundingBox": [
                                5.7621,
                                1.5114,
                                6.5483,
                                1.5114,
                                6.5483,
                                1.6151,
                                5.7621,
                                1.6151
                            ],
                            "text": "Consultants",
                            "confidence": 1
                        }
                    ]
                }

但是return它是

"boundingBox": [
                        4.4033,
                        1.5114,
                        6.5483,
                        1.5114,
                        6.5483,
                        1.6407,
                        4.4033,
                        1.6407
                    ],
                    "text": "Invoice For:",
                    "value": "First Up Consultants"

}

如果这不是我在 Azure 表单识别器中可以做的事情,那么不用担心。我就是想看看。

提前致谢! 迈克尔

听起来您正在寻找从文档中提取语义的意思。在这种情况下,您可能需要考虑使用自定义表单识别器模型。

您可以先训练自定义模型来提取键值对: https://docs.microsoft.com/en-us/azure/cognitive-services/form-recognizer/quickstarts/curl-train-extract

示例键值对:

{
    "key": {
        "text": "Address:",
        "boundingBox": [ 0.7972, 1.5125, 1.3958, 1.5125, 1.3958, 1.6431, 0.7972, 1.6431 ]
    },
    "value": {
        "text": "1 Redmond way Suite 6000 Redmond, WA 99243",
        "boundingBox": [ 0.7972, 1.6764, 2.15, 1.6764, 2.15, 2.2181, 0.7972, 2.2181 ]
    },
    "confidence": 0.86
}

或者您可以使用您提供的标签训练自定义模型: https://docs.microsoft.com/en-us/azure/cognitive-services/form-recognizer/quickstarts/label-tool

示例字段输出:

{
    "total": {
        "type": "string",
        "valueString": ",123.24",
        "text": ",123.24",
        "boundingBox": [ 5.29, 3.41, 5.975, 3.41, 5.975, 3.54, 5.29, 3.54 ],
        "page": 1,
        "confidence": 1
    }
}