hocr-parser 0.1.0

A parser for the hOCR format
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use hocr_parser::HOCR;

fn main() -> hocr_parser::Result<()> {
    let xml_str = std::fs::read_to_string("examples/data/paper-image.hocr").unwrap();
    let hocr = HOCR::from_str(&xml_str)?;

    println!("OCR System: {}", &hocr.system);
    println!("Capabilities: {:?}", &hocr.capabilities);
    println!("Number of Pages: {:?}", &hocr.number_of_pages);
    println!("Langs: {:?}", &hocr.langs);
    println!("Scripts: {:?}", &hocr.scripts);
    println!("# of Elements: {}", hocr.iter().count());

    Ok(())
}