-
Notifications
You must be signed in to change notification settings - Fork 0
/
word.go
32 lines (26 loc) · 987 Bytes
/
word.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package textractor
import "github.com/aws/aws-sdk-go-v2/service/textract/types"
// Word represents a word extracted by Textract.
type Word struct {
base // Embedding the base type for common attributes
text string // The text content of the word
textType types.TextType // The text type of the word (e.g., printed or handwriting)
line *Line // The line to which the word belongs
tableCell *TableCell // The table cell to which the word belongs
}
// Text returns the text content of the word.
func (w *Word) Text() string {
return w.text
}
// TextType returns the text type of the word.
func (w *Word) TextType() types.TextType {
return w.textType
}
// IsPrinted checks if the word is printed text.
func (w *Word) IsPrinted() bool {
return w.TextType() == types.TextTypePrinted
}
// IsHandwriting checks if the word is handwriting.
func (w *Word) IsHandwriting() bool {
return w.TextType() == types.TextTypeHandwriting
}