Shing Ho Tan
Shing Ho Tan

Reputation: 951

Google Cloud Vision API get key of the extracted text

I am using Google Cloud Vision API for scanning the business card using React-Native and the OCR part is working well. This is the my current archivement.

The original image Android app

As you can see in the second image, the app is recognizing the text as well and I want to map it to key. Means I want to map "JOHN" to "First Name" and "SMITH" to "Last Name", +0 123 456 789 324 to "Phone Number".

'https://vision.googleapis.com/v1/images:annotate?key=' +
        'YOUR_API_KEY',
      {
        method: 'POST',
        body: JSON.stringify({
          requests: [
            {
              image: {content: this.state.image.base64},
              features: [{type: 'TEXT_DETECTION'}],
            },
          ],
        }),
      },

This is my current payload. What do you think should I use for labeling the text? Please teach me as soon as possible.

Upvotes: 0

Views: 910

Answers (2)

IDMT
IDMT

Reputation: 176

If I understand this correctly, you are expecting from Cloud Vision API to classify detected text, e.g John Smith -> name, +0 12345678 -> phone, etc. If this is the case, I would suggest to use ML with a trained model to classify detected text. To do so, you can take a look on Training a model to identify names appearing in a sentence and do the same for addresses, phone numbers, etc.

Upvotes: 0

Jun
Jun

Reputation: 3432

You can google "text analysis api" and find the services suitable for your needs.

Upvotes: 1

Related Questions