formrecognizer

package module
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 6, 2023 License: Apache-2.0 Imports: 11 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

Go FormRecognizer

Early release of Golang wrapper for Microsoft's Form Recognizer API.

This library provides a Go client for Microsoft Form Recognizer API.

Installation:

go get github.com/coggsfl/formrecognizer

Form Recognier example usage:

package main

import (
	"context"
	"fmt"
	formrecognizer "github.com/coggsfl/formrecognizer"
)

func main() {

	form_recognizer_client := formrecognizer.NewClient("your Form Recognizer Key", "https://your Form Recognizer Endpoint")
	filename = "./local_document.pdf"
	form_recognizer_results := form_recognizer_client.Begin_analyze_document("prebuilt-layout", filename, "32")

	do_something_cool_with(form_recognizer_results)

}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is Forms Recognizer client.

func NewClient

func NewClient(apiKey string, baseUrl string) *Client

NewClient creates new Forms Recognizer API client.

func NewClientWithConfig

func NewClientWithConfig(config ClientConfig) *Client

NewClientWithConfig creates new Forms Recognizer API client for specified config.

func (*Client) Begin_analyze_document

func (c *Client) Begin_analyze_document(model string, document string, pages string) FormGenResponse

type ClientConfig

type ClientConfig struct {
	BaseURL    string
	APIVersion string
	HTTPClient *http.Client
	// contains filtered or unexported fields
}

Client is Forms Recognizer client.

func DefaultConfig

func DefaultConfig(apiKey string, baseUrl string) ClientConfig

type FormGenResponse

type FormGenResponse struct {
	Status              string    `json:"status"`
	CreatedDateTime     time.Time `json:"createdDateTime"`
	LastUpdatedDateTime time.Time `json:"lastUpdatedDateTime"`
	AnalyzeResult       struct {
		APIVersion      string `json:"apiVersion"`
		ModelID         string `json:"modelId"`
		StringIndexType string `json:"stringIndexType"`
		Content         string `json:"content"`
		Pages           []struct {
			PageNumber int     `json:"pageNumber"`
			Angle      int     `json:"angle"`
			Width      float64 `json:"width"`
			Height     int     `json:"height"`
			Unit       string  `json:"unit"`
			Words      []struct {
				Content    string    `json:"content"`
				Polygon    []float64 `json:"polygon"`
				Confidence int       `json:"confidence"`
				Span       struct {
					Offset int `json:"offset"`
					Length int `json:"length"`
				} `json:"span"`
			} `json:"words"`
			Lines []struct {
				Content string    `json:"content"`
				Polygon []float64 `json:"polygon"`
				Spans   []struct {
					Offset int `json:"offset"`
					Length int `json:"length"`
				} `json:"spans"`
			} `json:"lines"`
			Spans []struct {
				Offset int `json:"offset"`
				Length int `json:"length"`
			} `json:"spans"`
			Kind string `json:"kind"`
		} `json:"pages"`
		Tables []struct {
			RowCount    int `json:"rowCount"`
			ColumnCount int `json:"columnCount"`
			Cells       []struct {
				Kind            string `json:"kind,omitempty"`
				RowIndex        int    `json:"rowIndex"`
				ColumnIndex     int    `json:"columnIndex"`
				Content         string `json:"content"`
				BoundingRegions []struct {
					PageNumber int       `json:"pageNumber"`
					Polygon    []float64 `json:"polygon"`
				} `json:"boundingRegions"`
				Spans []struct {
					Offset int `json:"offset"`
					Length int `json:"length"`
				} `json:"spans"`
			} `json:"cells"`
			BoundingRegions []struct {
				PageNumber int       `json:"pageNumber"`
				Polygon    []float64 `json:"polygon"`
			} `json:"boundingRegions"`
			Spans []struct {
				Offset int `json:"offset"`
				Length int `json:"length"`
			} `json:"spans"`
		} `json:"tables"`
		Paragraphs []struct {
			Spans []struct {
				Offset int `json:"offset"`
				Length int `json:"length"`
			} `json:"spans"`
			BoundingRegions []struct {
				PageNumber int       `json:"pageNumber"`
				Polygon    []float64 `json:"polygon"`
			} `json:"boundingRegions"`
			Role    string `json:"role,omitempty"`
			Content string `json:"content"`
		} `json:"paragraphs"`
		Styles []any `json:"styles"`
	} `json:"analyzeResult"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL