src/main/java/eu/digitisation/text/Text.java
private void readHOCRFile(File file) throws WarningException {
        try {
            org.jsoup.nodes.Document doc = org.jsoup.Jsoup.parse(file, null);
            Charset htmlEncoding = doc.outputSettings().charset();

            if (htmlEncoding == null) {
                encoding = Encoding.detect(file);
                Messages.warning("No charset declaration in "
                        + file + ". Using " + encoding);
            } else {
                encoding = htmlEncoding;
                Messages.info("HTML file " + file
                        + " encoding is " + encoding);
            }

            for (org.jsoup.nodes.Element e
                    : doc.body().select("*[class=ocr_line")) {
                String text = e.text();
                add(text);

            }
        } catch (IOException ex) {
            Messages.info(Text.class.getName() + ": " + ex);
        }
    }
/**
     * Reads textual content from HOCR HTML file
     *
     * @param file the input HTML file
     */
Reads textual content from HOCR HTML file
@param file the input HTML file
Reads textual content from HOCR HTML file @param file the input HTML file
private void readHOCRFile(File file) throws WarningException {
        try {
            org.jsoup.nodes.Document doc = org.jsoup.Jsoup.parse(file, null);
            Charset htmlEncoding = doc.outputSettings().charset();
            if (htmlEncoding == null) {
                encoding = Encoding.detect(file);
                Messages.warning("No charset declaration in "
                        + file + ". Using " + encoding);
            } else {
                encoding = htmlEncoding;
                Messages.info("HTML file " + file
                        + " encoding is " + encoding);
            }
            for (org.jsoup.nodes.Element e
                    : doc.body().select("*[class=ocr_line")) {
                String text = e.text();
                add(text);
            }
        } catch (IOException ex) {
            Messages.info(Text.class.getName() + ": " + ex);
        }
    }
private void readHOCRFile ( File file ) throws WarningException { try { org . jsoup . nodes . Document doc = org . jsoup . Jsoup . parse ( file , null ) ; Charset htmlEncoding = doc . outputSettings ( ) . charset ( ) ; if ( htmlEncoding == null ) { encoding = Encoding . detect ( file ) ; Messages . warning ( "No charset declaration in " + file + ". Using " + encoding ) ; } else { encoding = htmlEncoding ; Messages . info ( "HTML file " + file + " encoding is " + encoding ) ; } for ( org . jsoup . nodes . Element e : doc . body ( ) . select ( "*[class=ocr_line" ) ) { String text = e . text ( ) ; add ( text ) ; } } catch ( IOException ex ) { Messages . info ( Text . class . getName ( ) + ": " + ex ) ; } }
Reads textual content from HOCR HTML file
 @param file the input HTML file
Reads textual content from HOCR HTML file @param file the input HTML file