Documentation ¶
Index ¶
- func GetFileNameFromBucket(ctx context.Context, gcsBucket, path string, client *storage.Client) (string, error)
- func GetFileNamesFromBucket(ctx context.Context, gcsBucket, path string, client *storage.Client) ([]string, error)
- func GetObjectHandlesFromBucket(ctx context.Context, gcsBucket, path string, client *storage.Client) ([]*storage.ObjectAttrs, error)
- func RetrieveText(response *DocumentDetectResponse) (string, error)
- func UploadTextToGCS(ctx context.Context, text string, storageBucket, bucketPath string, ...)
- type DocumentDetectResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetFileNameFromBucket ¶
func GetFileNameFromBucket(ctx context.Context, gcsBucket, path string, client *storage.Client) (string, error)
GetFileNameFromBucket gets a file name from a bucket
func GetFileNamesFromBucket ¶
func GetObjectHandlesFromBucket ¶
func GetObjectHandlesFromBucket(ctx context.Context, gcsBucket, path string, client *storage.Client) ([]*storage.ObjectAttrs, error)
GetObjectHandlesFromBucket returns a list of object handles from a given bucket and path
func RetrieveText ¶
func RetrieveText(response *DocumentDetectResponse) (string, error)
RetrieveText parses the JSON and retrieves only the relevant text elements
Types ¶
type DocumentDetectResponse ¶
type DocumentDetectResponse struct { InputConfig struct { GcsSource struct { URI string `json:"uri"` } `json:"gcsSource"` MimeType string `json:"mimeType"` } `json:"inputConfig"` Responses []struct { Context struct { PageNumber int `json:"pageNumber"` URI string `json:"uri"` } `json:"context"` FullTextAnnotation struct { Pages []struct { Blocks []struct { BlockType string `json:"blockType"` BoundingBox struct { NormalizedVertices []struct { X float64 `json:"x"` Y float64 `json:"y"` } `json:"normalizedVertices"` } `json:"boundingBox"` Confidence float64 `json:"confidence"` Paragraphs []struct { BoundingBox struct { NormalizedVertices []struct { X float64 `json:"x"` Y float64 `json:"y"` } `json:"normalizedVertices"` } `json:"boundingBox"` Confidence float64 `json:"confidence"` Words []struct { BoundingBox struct { NormalizedVertices []struct { X float64 `json:"x"` Y float64 `json:"y"` } `json:"normalizedVertices"` } `json:"boundingBox"` Confidence float64 `json:"confidence"` Property struct { DetectedLanguages []struct { LanguageCode string `json:"languageCode"` } `json:"detectedLanguages"` } `json:"property"` Symbols []struct { Confidence float64 `json:"confidence"` Property struct { DetectedLanguages []struct { LanguageCode string `json:"languageCode"` } `json:"detectedLanguages"` } `json:"property"` Text string `json:"text"` } `json:"symbols"` } `json:"words"` } `json:"paragraphs"` } `json:"blocks"` Height int `json:"height"` Property struct { DetectedLanguages []struct { Confidence float64 `json:"confidence"` LanguageCode string `json:"languageCode"` } `json:"detectedLanguages"` } `json:"property"` Width int `json:"width"` } `json:"-"` Text string `json:"text"` } `json:"fullTextAnnotation"` } `json:"responses"` }
DocumentDetectResponse represents the output upon analyzing a document. The fulltext annotations are omitted to save space.
Click to show internal directories.
Click to hide internal directories.