Giter VIP home page Giter VIP logo

Comments (2)

ines avatar ines commented on May 18, 2024

Hi! This is a good question and definitely a valid point. There's no particular reason and the Matcher would definitely be the more elegant and scalable solution in this case. There are other cases where you might still want to iterate over the tokens โ€“ for instance, if you're working with the dependency tree or if you're extracting additional information after matching (e.g. check the previous sentence for something).

This particular exercise is based on a real example I once saw on Stack Overflow and I wanted to get the point of using the Doc as the "single source of truth" across. And since rewrite exercises are often a bit more challenging than "fill in the gaps", I didn't want to introduce any new concepts or new token attributes here, and keep the result a bit closer to the original code.

tl;dr: No particular reason, mostly to make the rewrite exercise more straightforward and not ask for too much at once. Matching is perfectly reasonable, too ๐Ÿ™‚

from spacy-course.

ab-10 avatar ab-10 commented on May 18, 2024

Hi @ines, thank you for the reply (and the exercises too), that clears things up and adds more context to the tradeoffs between the two methods.

from spacy-course.

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.