parse/
parse.rs

1use hocr_parser::HOCR;
2
3fn main() -> hocr_parser::Result<()> {
4    let xml_str = std::fs::read_to_string("examples/data/paper-image.hocr").unwrap();
5    let hocr = HOCR::from_str(&xml_str)?;
6
7    println!("OCR System: {}", &hocr.system);
8    println!("Capabilities: {:?}", &hocr.capabilities);
9    println!("Number of Pages: {:?}", &hocr.number_of_pages);
10    println!("Langs: {:?}", &hocr.langs);
11    println!("Scripts: {:?}", &hocr.scripts);
12    println!("# of Elements: {}", hocr.iter().count());
13
14    Ok(())
15}