GithubHelp home page GithubHelp logo

Comments (7)

clayms avatar clayms commented on June 15, 2024 2

ok! The following works

first (assuming you have mutool installed):

import subprocess
subprocess.Popen('mutool draw -o "ICUS_Rules_Clean_up.html" "ICUS_Rules_Clean_up.pdf"', shell=True) 

then

corpus_parser = Parser(structural=True, lingual=True, visual=True, pdf_path=pdf_path)
%time corpus_parser.apply(doc_preprocessor, parallelism=PARALLEL)

very slow for one document though

[INFO] fonduer.utils.udf - Clearing existing...
[INFO] fonduer.utils.udf - Running UDF...
CPU times: user 1.16 s, sys: 484 ms, total: 1.64 s
Wall time: 4min 44s

then

from fonduer import Document, Sentence
print("Documents:", session.query(Document).count())
print("Sentences:", session.query(Sentence).count())
Documents: 1
Sentences: 6858

mutool is open source so it seems you should be recommending this as the conversion tool.

from fonduer.

clayms avatar clayms commented on June 15, 2024

related to this HazyResearch/pdftotree#27 (comment) ?

When trying to use pdftotree I get the same error as reported in that issue when converting the pdf linked to above.

from fonduer.

lukehsiao avatar lukehsiao commented on June 15, 2024

@clayms can you try converting the PDF to HTML using Adobe Acrobat to see if that is successful?

from fonduer.

clayms avatar clayms commented on June 15, 2024

I don't have access to Acrobat, only the reader which only appears to convert to [.docx, .doc, .rtf, .xlsx, or .pptx]

As suggested in HazyResearch/pdftotree#38 (comment), I will convert to html through MS Word. I will let you know the results.

from fonduer.

clayms avatar clayms commented on June 15, 2024

Using MS Word to convert leads to this error:

UnicodeDecodeError: 'utf-8' codec can't decode byte 0x95 in position 240614: invalid start byte

I replaced the MS Word generated html file with the Poppler pdftohtml file and ran the same code again, and it worked, but only output 19 sentences from the first page again.

from fonduer.

clayms avatar clayms commented on June 15, 2024

possible alternative?

https://github.com/coolwanglu/pdf2htmlEX

from fonduer.

clayms avatar clayms commented on June 15, 2024

this looks promising

https://mupdf.com/docs/manual-mutool-draw.html

from fonduer.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.