forked from otiai10/gosseract
-
Notifications
You must be signed in to change notification settings - Fork 0
/
hocr.go
49 lines (43 loc) · 1.18 KB
/
hocr.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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package gosseract
/**
* NOTE:
* These structs are the very minimum implementation
* only to satisfy test assertions.
* TODO: Extend structs to cover main usecases.
**/
// Page represents `<div class='ocr_page' />`
type Page struct {
ID string `xml:"id,attr"`
Title string `xml:"title,attr"`
Class string `xml:"class,attr"`
Content Content `xml:"div"`
}
// Content represents `<div class='ocr_carea' />`
type Content struct {
ID string `xml:"id,attr"`
Title string `xml:"title,attr"`
Class string `xml:"class,attr"`
Par Par `xml:"p"`
}
// Par represents `<p class='ocr_par' />`
type Par struct {
ID string `xml:"id,attr"`
Title string `xml:"title,attr"`
Class string `xml:"class,attr"`
Language string `xml:"lang,attr"`
Lines []Line `xml:"span"`
}
// Line represents `<span class='ocr_line' />`
type Line struct {
ID string `xml:"id,attr"`
Title string `xml:"title,attr"`
Class string `xml:"class,attr"`
Words []Word `xml:"span"`
}
// Word represents `<span class='ocr_word' />`
type Word struct {
ID string `xml:"id,attr"`
Title string `xml:"title,attr"`
Class string `xml:"class,attr"`
Characters string `xml:",chardata"`
}