News for hackers. Stuff that matters.
Re:Textract, a Python package for extracting text from any d... by sheetjs on Sunday August 03, 2014 @05:40PM (#8129264)
The node module by the same name (https://github.com/dbashford/textract) also supports image OCR (via tesseract), excel files, RTF and other formats.
Re:Textract, a Python package for extracting text from any d... by wangman on Monday August 04, 2014 @06:46AM (#8131076)
I also assumed that it was some kind of Python wrapper or implementation of Tesseract OCR when I saw that name. One would think so when Tesseract being (one of?) the best preforming OCR-programs out there.
Re:Textract, a Python package for extracting text from any d... by shawnps on Sunday August 03, 2014 @08:15PM (#8129629)
Thanks for pointing this out. I've been working on a text extractor in Go at work and tried for a long time to get UnRTF working with RTF files containing Japanese characters to no avail. This lib lists catdoc as the extractor they use for RTF, so I'm going to give that a try.

Edit: Looks like catdoc doesn't work with RTF files containing Japanese characters either. Might end up having to use libreoffice or something like that.

Re:Textract, a Python package for extracting text from any d... by deanmalmgren on Monday August 04, 2014 @06:47AM (#8131079)
For what its worth, textract (python) also has ambitions of including OCR through the tesseract-ocr project https://github.com/deanmalmgren/textract/issues/16
Re:Textract, a Python package for extracting text from any d... by ddumas on Sunday August 03, 2014 @08:03PM (#8129604)
This looks nice. What I'd really like to see, along these lines, is a python library for automated document metadata extraction with confidence assessment, like this:

./autometa.py --author --verbose academic-paper.pdf

Author: "Edward Witten" Confidence: High (matches template "amslatex")

Re:Textract, a Python package for extracting text from any d... by deanmalmgren on Monday August 04, 2014 @06:46AM (#8131073)
I thought about the metadata thing but decided to exclude it for the earliest versions of textract to keep things simple. If you'd like to see it in there and have a good example of how you'd like to use metadata, please feel free to throw an issue on the issue tracker https://github.com/deanmalmgren/textract/issues/
Re:Textract, a Python package for extracting text from any d... by kalkin on Monday August 04, 2014 @01:25AM (#8130467)
As far as I have been able to tell, the public state of the art in academic paper metadata parsing is Grobid: https://github.com/kermitt2/grobid

Not quite as simple a commandline interface as you suggest, but not too hard to set up, and pretty impressive. Now if only Google Scholar would open-source whatever they use...

Re:Textract, a Python package for extracting text from any d... by emillon on Monday August 04, 2014 @09:27AM (#8131610)
For video files, guessit does something similar using only the file name:

http://guessit.readthedocs.org/

Re:Textract, a Python package for extracting text from any d... by quink on Sunday August 03, 2014 @09:06PM (#8129772)
I realise that it's nice that it'll give you a single function to dump whatever file format into (while actually running it through a shell command in the backend), but it's not that hard to:

  out = ""
  pdf = pyPdf.PdfFileReader(stream)
  try:
      if pdf.getIsEncrypted():
          pdf.decrypt('')
      for page in pdf.pages:
          out += page.extractText()
  except NotImplementedError:
      # Yeah, this ain't happening
Re:Textract, a Python package for extracting text from any d... by Contraptor on Monday August 04, 2014 @12:34PM (#8132593)
When I first read the headline, I thought there was a new python API or SDK for the already existing Textract OCR solution from Structurise. We've used Structurise's product called Textract for years at work, so it was definately around first. I'm not sure if the creators of this new solution/product were aware of the prior's existence, but using the same product name for a product that solves a similar problem seems like it would be an issue... or at the very least confusing.

Here's a link to StructuRise's Textract product page: http://www.structurise.com/textract/

Re:Textract, a Python package for extracting text from any d... by kalkin on Monday August 04, 2014 @01:22AM (#8130461)
I have a little shell script which tries to do basically this:

https://gist.github.com/djudd/1402751e2928cb8ac788

It tries either abiword or OpenOffice/LibreOffice for filetypes other than pdf, ps, and txt, which works pretty decently for doc, docx, ppt, etc.

One file type here that textract folks might want to add is Postscript.

Re:Textract, a Python package for extracting text from any d... by deanmalmgren on Monday August 04, 2014 @07:07AM (#8131148)
Thanks for the suggestion. I wasn't familiar with ps2ascii and I just created an issue here https://github.com/deanmalmgren/textract/issues/25
Re:Textract, a Python package for extracting text from any d... by jknz on Sunday August 03, 2014 @05:10PM (#8129180)
Apache Tika exists for years and seems to have the same goal: http://tika.apache.org/

I'm wondering why the authors wrote something from scratch ?

edit: this is answered by one author in the 2nd disqus comments of the link

Re:Textract, a Python package for extracting text from any d... by wiremine on Sunday August 03, 2014 @05:37PM (#8129260)
Here's the comment:

"Its very similar to Apache Tika (which I didn't know about until yesterday), but I think it is different in at least two important ways.

"1. The intention of textract is to provide many possible ways to extract text from any document, provided words appear in the correct order in the text output. By being method agnostic, its possible to use different parsing techniques in different situations. Here's more on that philosophy http://textract.readthedocs.or... and, to be fair, I'm not sure that Tika's philosophy differs in any meaningful way on this.

"2. Another subtle difference is that textract is written in python, which is a language that is used by nearly all data people that I know. Since the intent is to be a preprocessing framework for natural language processing, I wanted it to be as maintainable by the community as possible."

Re:Textract, a Python package for extracting text from any d... by lelf on Sunday August 03, 2014 @05:19PM (#8129210)
> wrote something from scratch ?

Looking at the source, they didn't lie about “no muss, no fuss”. It just antiword .docs, cat .txt etc

Re:Textract, a Python package for extracting text from any d... by oblio on Monday August 04, 2014 @03:14AM (#8130687)
Python version supported? Pypi doesn't list it.

On the same note, your pypi page is borked: https://pypi.python.org/pypi/textract

(look at Build status & co, there's a formatting error)

Re:Textract, a Python package for extracting text from any d... by deanmalmgren on Monday August 04, 2014 @07:04AM (#8131139)
Currently 2.7 but there's no reason python 3 can't be supported too. Thanks for the heads up on the borking of the pypi page. Noted.
Re:Textract, a Python package for extracting text from any d... by goblin89 on Sunday August 03, 2014 @07:57PM (#8129593)
> Ok, ok, ok. You can’t extract text from any document at the moment, but textract integrates support for many common formats and we designed it to be as easy as possible to add other document formats.

There go my hopes to see painless OCR library for Python…

Re:Textract, a Python package for extracting text from any d... by deanmalmgren on Monday August 04, 2014 @07:09AM (#8131156)
Hopefully it will be? There's a great suggestion to use tesseract-ocr to make this happen. https://github.com/deanmalmgren/textract/issues/16

If you have any other (better?) ways of doing this, feel free to add some comments on the issue tracker.

Re:Textract, a Python package for extracting text from any d... by minimaxir on Sunday August 03, 2014 @08:27PM (#8129667)
The list of common formats is still pretty robust.

http://textract.readthedocs.org/en/latest/#currently-support...

Re:Textract, a Python package for extracting text from any d... by haddr on Monday August 04, 2014 @10:10AM (#8131782)
Great tool! BTW. how does this compare to Apache Tika for text extraction from HTML pages?
Re:Textract, a Python package for extracting text from any d... by aphexcx on Tuesday August 05, 2014 @03:59AM (#8135966)
i'm using this for my git repos now. (I version control my word docs and pdfs.) here, I even made a post about it http://www.aphex.cx/2014/08/using-git-for-pdf-and-word-doc-f...
Re:Textract, a Python package for extracting text from any d... by ppod on Monday August 04, 2014 @05:37AM (#8130950)
Nice. Does it do any encoding conversion, e.g. latin1 to utf-8? Does Tika do that?
Re:Textract, a Python package for extracting text from any d... by hackerews on Sunday August 03, 2014 @11:20PM (#8130154)
i've always thought the datascope team was awesome. textract makes them even awesomer.
Re:Textract, a Python package for extracting text from any d... by jpulec on Sunday August 03, 2014 @09:26PM (#8129832)
This is awesome
Re:Textract, a Python package for extracting text from any d... by ealize on Sunday August 03, 2014 @04:44PM (#8129126)
Re:Textract, a Python package for extracting text from any d... by dang on Sunday August 03, 2014 @05:01PM (#8129158)