Code Monkey home page Code Monkey logo

Comments (8)

morungos avatar morungos commented on May 29, 2024 1

Do you have a test/public version of this .doc file you could share with me, then I can take a look? You send directly to [email protected] if you prefer.

from node-word-extractor.

SHocker-Yu avatar SHocker-Yu commented on May 29, 2024

thank you! i have sent two mails to you,the second one is my project.

from node-word-extractor.

morungos avatar morungos commented on May 29, 2024

Got the file. This is... interesting. I'm not getting the same error, and I am getting text out which visually matches the document. But there's some weird character-level stuff there too, which broke a test or two. So I'm going to dig at it.

What version of Node.js are you using? I'm suspicious there might be a Unicode type issue at play, and that has changed a bit across versions.

Haven't tried Windows yet, as that might be a factor too. I'll check that tomorrow.

from node-word-extractor.

SHocker-Yu avatar SHocker-Yu commented on May 29, 2024

OS:win 10
node:v4.4.7
the file contains chinese,it may be the reason of the weird character-level stuff.
thank you ,good night.

from node-word-extractor.

morungos avatar morungos commented on May 29, 2024

Ah, OK. I think this is a major documentation error. As far as I can tell, the WordExtractor#extract method returns a promise that resolves to a document, rather than a document.

I can't see how I didn't document this in the README.md (which I clearly didn't), because it looks like it was always this way, and the unit tests certainly work that way.

However, it does make sense, as otherwise it'd be blocking on I/O, and that's not good.

So try something along the lines of...

var WordExtractor = require("word-extractor");
var extractor = new WordExtractor();
var pd = extractor.extract("./testDocccccc.doc");
pd.then(function(doc) {
  console.log(doc.getBody);
});

Can you see if this works for you, and if so I'll amend the docs. The test files are a good place to look for examples, although expect obfuscates it a little.

And I'm truly sorry.

from node-word-extractor.

SHocker-Yu avatar SHocker-Yu commented on May 29, 2024

I'm sorry for replying you so late,we have a meeting all day.it is a good news for what you find.
i did the test just now,
and ''console.log(doc.getBody());'' missing brackets after getBody.
console output: This is a test for parsing the Word file in node.
sure,it works.
but the chinese in the files can't read successfully,my true files are all in chinese,could you help for that?
whatever,thank you very much!

from node-word-extractor.

SHocker-Yu avatar SHocker-Yu commented on May 29, 2024

Ah,it works for chinese,but change the position of paragraph, leading to the formation of text missing words.

from node-word-extractor.

morungos avatar morungos commented on May 29, 2024

Good for finding this. If you can make enough of a test case that I can get it, I'd be happy to look into this. It's very possible, given that the encodings used inside both Word and JavaScript are neither especially standard, and there could well be issues that have fallen in between.

I'd be happy to fix if you can find a small enough test file that I can understand, although it might be best flagging that as a new issue, and I'll use this to fix the docs

from node-word-extractor.

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.