Comments (2)
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.
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)
- Repeated failed connections trying to access course HOT 1
- Diagram for the Span object
- Building a training loop - update example from spacy101 v2.x tutorial
- Wrong word segmentation in chinese course HOT 1
- Advanced Spacy Course: Bowie is a word HOT 4
- Turkish Translation would be great idea ! HOT 4
- error in builidng docker HOT 1
- Chapter 2 ยง 4 prose disagrees with code HOT 1
- Chapter 1 q11 Matcher matches all text. HOT 2
- amendments suggestion HOT 2
- Trouble setting up a working JS environment for the course HOT 6
- French translation? HOT 2
- Chapter 1 Lesson 9 requires student to name the entity iterator variable 'ent' -- unnecessarily HOT 1
- Use Japanese model in Japanese translation HOT 10
- Phrase Matcher fails on custom tokens HOT 1
- Issue with matcher in Excercise 1.12.2 HOT 1
- Missing implementation to output matches from the matcher at chapter1_03_rule-based-matching.md
- JS code insdie <script> tags is not exectued
- Trouble running code for Exercise 5 in Chapter 4 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from spacy-course.