Code Monkey home page Code Monkey logo

Comments (5)

MegaIng avatar MegaIng commented on June 12, 2024

I don't know where @erezsh got that from, Lark has never supported passing in a file object (or any IOStream) to .parse. This is also quite hard to add since we are using re, which can't deal with those objects directly, I can try to add support for it.

Ofcourse, if the file is smaller than a few MB, just loading it into memory is the better choice for speed.

from lark.

erezsh avatar erezsh commented on June 12, 2024

@erezsh showed that Lark's parse method takes a file argument so that Lark can read the file as it needs to.

I don't think that I did.

from lark.

MegaIng avatar MegaIng commented on June 12, 2024

@erezsh showed that Lark's parse method takes a file argument so that Lark can read the file as it needs to.

I don't think that I did.

You did, the quote is exactly what you wrote.

from lark.

erezsh avatar erezsh commented on June 12, 2024

@iainelder My bad, I was wrong, and I apologize for misleading you. You should read the file yourself, and provide it to Lark as a string.

If you need to parse a very large file, there might be a way to do so incrementally, but a solution isn't yet written or tested. See #1211 .

from lark.

iainelder avatar iainelder commented on June 12, 2024

If the file is smaller than a few MB, just loading it into memory is the better choice for speed.

My data is small enough that I can work like this.

Thanks for clarifying. The documentation does show that parse expects a string, but that issue ranks high on Google :-)

from lark.

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.