Extracting sentences from PDF


I’m was wondering if there is a concept of a sentence. I can see lines but nothing about sentences.

If not is there an easy/recommended way to build up the sentences within a document, as this would be useful for on-line speech streaming


A PDF document does not include a concept of a sentence. It does not even include a concept of a paragraph, a line, or a word. At the same time we offer a utility class (pdftron.PDF.TextExtractor, as shown in TextExtract sample - http://www.pdftron.com/pdfnet/samplecode.html#TextExtract) that can be used to reconstruct words, lines, and paragraphs based on several cues (e.g. spatial info, font, size, color, etc.).

TextExtractor does not recognize sentences, however if you are using ‘.’ as the only cue to separate sentences, it should be fairly easy to group words within a paragraph/flow. Btw. you can obtain Unicode/text data for each word/line using GetString () method:


Just to add to the above post — after extracting text with TextExtractor, you may want to look into third-party tools for grouping natural language text into sentences. One of these is NLTK’s “punkt” module: