PDF Parsing with Text and Coordinates [closed] - parsing

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 1 year ago.
Improve this question
I am currently using PDF Box to parse a pdf and I am trying to figure out how to retrieve data about the text such as the font (bold, size, etc) and the location of the font.
Any suggestions?

After poking around the (hard to find) PDFBox docs, I found this little gem.
Apparently one of the examples shows exactly how to do everything you asked. Basically, you subclass PdfTextStripper and override the processTextPosition method. There, you query the TextPosition for whatever information you need.
For future reference, you can find the javaDoc here: http://pdfbox.apache.org/apidocs/index.html
Edit 2018-04-02: original link is dead, but example can be found in the SVN repo here.

One of the best things for text extraction from PDFs is TET, the text extraction toolkit. TET is part of the PDFlib.com family of products.
PDFlib.com is Thomas Merz's (the author of the "PostScript and PDF Bible") company.
TET's first incarnation is a library. That one can probably do everything you want, including to positional information about each text element on the page. Oh, and it can also extract images. It recombines+merges images which are fragmented into pieces.
pdflib.com also offers another incarnation of this technology, the TET plugin for Acrobat. Obviously you'd need Acrobat as well to make use of this.
And the third incarnation is the PDFlib TET iFilter. This is a standalone tool for user workstations. Both this is free (as in beer) to use for private, non-commercial purposes.
Lastly, TET also comes with a commandline interface.
TET is really powerful. Way better than Adobe's own text extraction. It extracted text for me where other tools (including Adobe's) do spit out garbage only.
A few months ago I tested their desktop standalone tool, and what they say on their webpage is true. It has a very good commandline. Some of my "problematic" PDF test files the tool handled to my full satisfaction.
This thing is my recommendation for every sophisticated and challenging PDF text extraction requirements.
TET is simply awesome. It detects tables. Inside tables, it identifies cells spanning multiple columns. It identifies table rows and contents of each table cell separately. It deals very well with hyphenations: it removes hyphens and restores complete words. It supports non-ASCII languages (including CJK, Arabic and Hebrew). When encountering ligatures, it restores the original characters...
Give it a try.

The GetPageText function with extract option 3 or 4 in Quick PDF Library returns a CSV string for the selected page which includes the text (either individual words or a piece of text) and the related font name, text color, text size and co-ordinates on the page.
Note: it is a commercial library and I work for the company that sells it.

PDF files can be parsed with tabula-py, or tabula-java.
I made a full tutorial on how to use tabula-py on this article. You can tabula in a web-browser too as long as you have installed Java.

Related

Human annotation tool for corpora in NLP [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 4 years ago.
Improve this question
I am trying to build my own training corpus for Named Entity Recognition, but I don't know if there is already an existing tool for this or if I have to implement one myself.
Basically, what I need to do is take a corpus and manually tag it word by word, which is pretty tedious, but it has to be done.
Can anyone tell me if there is already an existing one and where to get it?
I had a good experience working with BRAT.
GATE is also a very complex tool for annotating, steeper learning curve.
We had a nice experience using DataTurks . They provide nice intuitive UI which allows to add collaborator, insights into data, leaderboard for annotators and some other funky features.
https://dataturks.com
For online annotation of text or HTML corpus of relatively short documents I also recommend BRAT. You will have to go under the hood of the python web application if you want to do anything custom. It also failed to work for me on large HTML documents (100 or so pages).
I have also used stand-alone apps:
Protege + Knowtator: a bit cumbersome to setup / use, but it
works;
Gate: also cumbersome, and it somewhat works. Backup
your annotations at regular intervals as you might get
surprised by a stacktrace that also wiped or corrupted your annotated
corpus (which is just serialized Java objects).
If you are dealing with PDF documents, we built a web-based PDF Annotation Tool: NOTA. It accepts anything printed to PDF, including scans. We do commercial OCR on our end to recover text from images. There is a REST API to create color-coded annotation schemas and pre-populate documents with annotations, as well as a REST API for exporting formatted text and annotation offsets. There is also a JS API you can use to customize any annotation workflows, add metadata to annotations, etc. Relationships are not supported out of the box. Large documents, 200+ pages are supported. Email us and we can give you an API key to try it out. Details and documentation links can be found here. It is free for small research projects.
Here is a screenshot of what the annotations looks like :
I co-develop myself the web-based text annotation tool: tagtog.net
There is nothing to install, and you can define the type of entities you want to annotate. Additionally you can annotation relationships, document labels, and much more. You can upload your documents in many different formats, including PDF or markdown. You can annotate together with your team collaboratively. We have put great care in making the interface easy and beautiful. It looks like this:
You can start right away with a free account. Also I would be happy to help you with any doubt or issue you may have; just ping me or write us an email to the address shown on the website, tagtog.net.
Our annotation tool Prodigy is very scriptable, and is designed for active learning. It integrates especially well with our NLP library spaCy.
We've paid particular attention to the Named Entity Recogntion (NER) annotation workflows, as entity recognition can otherwise be very slow. I have a tutorial video on this:
https://www.youtube.com/watch?v=l4scwf8KeIA
There is this tool called, Dataturks is super simple to use, fully online NLP annotation tool, so that I even can easily push my teammates to complete datasets for our projects.
try TagEditor ,
It is a desktop application designed to annotate text for training with spaCy library.
You can tag Named Entities, Dependencies, Parts of speech, text categories
and print json file.
Example

free visual editor for graph (dot) files [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 8 years ago.
Improve this question
Is there a free (as in "cheers"), linux-compatible, interactive visual editor for graphviz or other graphs? aptitude seems to be drawing a blank.
edit: "cheers" means both "beer" and "speech". meta-edit: I guess it should be "free as in beach".
edit 2: Maybe a suitable svg editor would be a more realistic goal. I basically want something that can be used to conveniently create a collection of labeled shapes and lines which connect them. Actually it would probably make more theoretical sense to extract the graph from this data, since it includes both semantic data (the graph) and presentation data (the way it's arranged on the screen, the colours used, etc). Is there a way to lay out labeled shapes conveniently with inkscape or some other free vector graphics editor? I really need rearranging of the nodes, and (re)flowing of the text in them, to happen with maximum convenience.
I've also realized that this is really a superuser question. I was going to repost it over there when I found an existing question that seems likely to provide me with an answer: dia.
edit 3: dia seems useful except that it doesn't seem to be possible to get the textual contents of node objects to wrap in any useful manner (ie any way other than by inserting manual line breaks). This is kind of a dealbreaker, since it screws most of the convenience factor that's my incentive to do things this way rather than with a text editor or a pen and paper. But it supports some sort of event model and Python-based scripting, so I'm going to dig around a bit and see if I can use python to wrap the text in response to content changes. Unless one of you lovely people has a better idea..? Basically I want to have the option to explicitly set the node size via GUI interaction, and have the contents wrap and rescale (within a certain range of font sizes) to fit it. Rich text would be pretty useful.
In other words, this is actually a valid SO question at this point, since it appears to require coding.
To save time those eager to try existing programs handling DOT graphs:
dotty can display DOT graphs and with little luck you can move its nodes with a mouse, nothing more, and you can easily segfault as a bonus (I tried latest stable graphviz)
lefty is only a special-purpose language interpreter used by dotty, nothing to look at
KGraphEditor is an empty wishful project (a QT window and a few buttons)
gvedit is not really a graph editor: it provides a simple text editor and you hit F5 to run a layout tool and open a picture; you can actually get more functionality from configuring your own favourite text editor
grappa is an abandoned java applet, which I failed to run
interestingly, dia can export to DOT ("PyDia DOT Export"), but due to its buggy printing, you have to post-process the files to use them
graphedit can read in DOT a graph and you can move its nodes around and change their colors
Eclipse people started working on DOT support in GEF4, so it can display DOT graphs
GraphUI has a very interesting demonstration video, but beware: although it might seem that the graph is being created by clicking and dragging, in reality all editing happens through the keyboard, using shortcuts. On the plus side, contextual instructions are always available showing which shortcuts do what.
DotEditor claims a tree editor, modifying node attributes/color/shape with mouse.
The graph editors mentioned in other answers, yEd (a Java application) and JointJS/Rappid (a JaveScript thing) apparently have nothing to do with DOT (tried both).
I believe there exist no working DOT-handling graph editor out there at all.
JointJS is a Javascript graph editing library based on Backbone : http://www.jointjs.com/
The author also provides Rappid, an online graph editor which might suit your needs, I don't know about dot files import though.

How to generate a printed form with dynamic inputs [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 4 years ago.
Improve this question
Our customer would like to give participation certificates for students undergoing a singing class. Currently they have printed certificates where in they fill the candidate name and the grade he obtained with the teachers signature.
We would like to automate this, so that the dynamic output mentioned above is automatically printed somehow on this sheet. How do we do this? Are there any tools which help you with positioning the dynamic output onto this template sheet.
http://www.123certificates.com provides some of the capabilities but looks like printing will happen on an A-4 sheet, how would you make this print on a dynamic template (either in pdf or word)
Not sure what the correct tags are for this question
You could just use OpenOffice (or MS's suite) with mailing fonctionnality. For precise placement, you could use a document with tables having fixed columns/row length.
For example, you'd have blank OO Writer document, with tables, and you'd positions the wanted fields accordingly. Since it's a certificate, maybe you'll want to put the page in landscape mode.
You'd have another OO Calc document, with the names of all the people you'd want to print a certificate for.
Then you just follow this tutorial on mail merging:
http://documentation.openoffice.org/HOW_TO/word_processing/writer2_EN.html
Print your page a few times on a blank sheet to see if everything fits/align properly.
Oh, and watch out for long names.
Then you can print it on the "real" certificate paper.
I've seen things like this done all the time in office settings and, as Aissen said, it's often referred to as "mail merging" and is used to create things called "form letters." Typically you have a list of data (often in a spreadsheet like Excel) and a corresponding document with "place holders." Each column in the spreadsheet corresponds to a "place holder" on the form/document (certificate in your case) and each row in the sheet represents a separate document/certificate.
It's very easy to do and very well documented online and, fortunately, is one of the primary features of Microsoft Word. Here are some examples:
Best Example
(VIDEO): Use an excel file to mail merge names into a word document--certificates of completion for a group of students
Other Examples
(Video): Microsoft Word: Mail Merge
(Video): Wdandp Presents: How to Use Mail Merge
(Video): How to Do a Mail Merge in Microsoft Word & Open Office
(MS Support Document): How to use mail merge to create form letters in Word
(Tutorial): Preparing a form letter with Word and Excel
I hope some of that helps in some way! In the very first video, they are doing EXACTLY what you need.
gMale

Open Source LaTeX environment for educational books? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
Fully aware of the LaTeX features to define new environment allowing me to do about anything, I was wondering if there are Open Source packages that allows me to do book branding by predefining environments for examples, excursions, listings, question sections, etc. For example, have an example environment with a blue-ish background, sections with further details which can be skipped by the casual reader in yellow, etc.
Today, I have been playing a bit with the float package, and customized the .sty to have a environment with a blue background, but did not manage to tune the macro's such to have change the font style to sans-serif.
Now, this is just an example, but I figured that many people must have been doing this to give their book a somewhat more professional look. Are there LaTeX package around that allow me to focus on the content, instead spending time on LaTeX coding to make environments stand out from the main text?
Is there a document class that allows me to just do:
\documentclass{fancyeducationalbook}
\begin{document}
\begin[bgcolor=orange]{fancyExampleEnvironment}
% showing up in the PDF with a orange background
\end{fancyExampleEnvironment}
\end{document}
It does not have to be perfect at all, but it does need to make various boxes stand out, and immediately be recognizable for first-year students as having some purpose (example, further reading, definition, etc); The key is that it makes the book look attractive.
I do not mind some hacking, but a good basis would be nice. Very much preferred, this base would be Open Source, so that I can reshare my customizations, if any needed.
Update: I'd welcome a system which supports multipage environments.
I did ask a similar question a few weeks ago:
https://stackoverflow.com/questions/1783400/developing-ebooks-software
where a couple of responses mentioned some other tools and packages.
Obviously LaTeX has the book style and those sorts of things, but one must remember it's primarily a scientific document producing tool - which it's fantastic for, but for other tasks there are often tools more suited to the job:
http://en.wikipedia.org/wiki/EPUB - the e-book publishing standard
http://code.google.com/p/sigil/ - a free GNUv3 editor for edocs
http://www.lulu.com/ - a fully integrated publishing toolset - for creating, editing and selling ebooks (if you want to go that far) - although this one's not open source of course...
Good luck, let us know what you find if you spot anything else - I'm still on the hunt for the 'ideal' tool :)
The usual recommendation for a more configurable long document class is memoir (read the extensive [manual PDF link).
Colored environment background and the like will probably have to be brought in with additional classes.
Take a look at context, a tex-based typesetting system which was designed for education publishing. It deals with page layout in a much more sophisticated manner than latex, and can give much more distinctive results.
I recommend not using anything fancy when writing the context: focus on the text and content-necessary graphics until the text is complete; get it edited and only then work through the typesetting. Trying to edit the document after it has been typeset is an invitation to redo work.
It is fairly painless to convert from latex to context. There's more work involved learning context than latex, but, well, you want good results?
Postscript: ConTeXt: An Excursion provides an introduction to the main document preparation features of context, and showcases its integration with metapost. The document has hyperlink navigation, which doesn't work with all pdf viewers.
Some of the documents on the TeX Showcase are prepared in context. There are some impressive latex examples there, too: you can get good results with latex, but it is, I think much harder work.
The contextgarden wiki has a list of official documentation, and From LaTeX to ConTeXt, the document migration advice. Migrating documents isn't hard, once you've got the hang of context.
Related questions:
LaTeX report chapter styles
Edit #2: you may want to check out http://www.math.harvard.edu/computing/latex/color.html, particularly the section about 2/3 of the way down called "Coloured box backgrounds"... also this link http://www.latex-community.org/forum/viewtopic.php?f=5&t=1441&start=0&st=0&sk=t&sd=a talks about the framed package which will color environment backgrounds, apparently.
Edit: Made it into its own command.
\documentclass[10pt]{article}
\usepackage{tikz}
\definecolor{shade}{HTML}{884763}
\newcommand{\uglybg}[1]{%
\begin{tikzpicture}
\node [fill=shade,rounded corners=5pt]
{%
\begin{minipage}{1\textwidth}
#1
\end{minipage}
};%
\end{tikzpicture}
}
\begin{document}
\uglybg{some text here please}
\end{document}
Profr. Jim Hefferon has written a book on Linear Algebra using LaTeX. He shares the source code in the following site:
http://joshua.smcvt.edu/linearalgebra/
The terms of use of the source code are the GNU Free Documentation License
(http://www.gnu.org/copyleft/fdl.html)
Check out his code. I like the formatting of the book.
I am doing some notes on basic math, but to be honest,
I think that the macros still need improvement.
Check out the notes (all in spanish) at
http://www.aprendematematicas.org.mx/notas.html

What do you use to capture webpages, diagram/pictures and code snippets for later reference? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 2 years ago.
Improve this question
What do you use to capture webpages, diagram/pictures and code snippets for later reference?
Evernote http://www.evernote.com and delicious http://www.delicious.com
Evernote
Notepad2's clipboard feature (Notepad2.exe /c as a link in Launchy)
Windows Clippings or PrintKey
Firefox extension Page Saver
Delicious
Microsoft OneNote.
I just have an emacs instance running on my home machine, under screen. Whereever I am (and have network) I can connect to it remotely. I stick all useful urls, birthday present ideas, future dates, code snippets, ideas for docs etcetc in there.
I rarely have doodles/diagrams I need to capture, I tend to draw them in ascii in my file if needed.
I must admit I'm a bit stuck if I have no network/wifi somewhere, but that's rarely the case.
I find google notebook is very good for drive by code snippeting and google bookmarks especially as when used with the google toolbar, for web pages.
The benefit of these tools are that they are available from any pc on the web, though a good use of semantic organisation using labels is recommended.
Here's my response to a similar question:
The combination of OneNote with a tablet PC is awesome! I was a bit of a skeptic at first. I used the trial version and then forgot about it. A year later I had an unruly collection of files, project related emails, notebooks and scraps of paper all scattered throughout my life. I went back to OneNote and all my problems went away. Some highlights:
Everything is searchable. The character recognition is good enough that my chicken-scratch meeting notes can be searched. Text within images is searchable.
OneNote syncs with Outlook so finding meeting notes is a breeze.
I now embed all files into OneNote - pdfs, spreadsheets, word docs, images, web clippings.
OneNote is constantly saving all changes so, combined with a scheduled automated backup, everything is in one place and is safe.
There are some built-in collaboration tools I have yet to try but that look useful.
It is SO worth the price. It allows you to get started on a project and avoid all that time spent deciding how to organize things.
Zotero, is a nice plugin for Firefox.
SnagIt
captures everything you could want, and lets you annotate it.
I prefer to use the good old url for delicious
Apart from that i use the Scrapbook extension in firefox when i want to save something on the disk. It's possible to tag the page, edit it and remove those stupids ads before saving it.
I also have a Wiki on a stick that i carry around on a usbkey for code snippets that should go to other clients when i'm travelling around
Mostly, my code snippets are embedded into projects i carry on the same usb key, which allows me to demonstrate some technologies right off to the client and get his advice based on a demonstration, not a listing of code...
For screen shots, I use a mix between ScrapBook and ScreenGrab. They are both firefox plugins that are pretty amazing when you need to get a screenshot of a page for editing. Works great for consulting.
https://addons.mozilla.org/en-US/firefox/addon/427
https://addons.mozilla.org/en-US/firefox/addon/1146
Delicious Bookmarks extension for Firefox
It's a little primitive, but I've been using tiddlywiki (self-contained, single-file wiki) http://www.tiddlywiki.com/ which works good for basic text and markup. I combine it with a plugin to sync it with Outlook's notes (http://syncoutlooknotes.tiddlyspot.com/#SyncOutlookNotes) so that I can then sync it to my blackberry using the standard outlook-blackberry sync mechanism. This has the significant advantage that I can look at my notes and even write new notes when I'm out and about, away from my laptop, or just don't feel like lugging the laptop around to a meeting that I don't really need it for.
I'd prefer using something more advanced like Onenote, but being able to take my notes with my in the little blackberry has turned out to be a significant advantage.
Google Notebook is very convenient tool. You can clip and save any parts of web pages without leaving your browser tab. The Notebook plug-in automatically saves them as separate notes in your notebooks and keep the links back to the original web pages. You can organize your clippings later by moving them between your notebooks and/or tagging them. Very good for code snippets and references.

Resources