{"id":13400178,"url":"https://github.com/explosion/spacy-course","last_synced_at":"2025-05-15T09:06:27.754Z","repository":{"id":37394094,"uuid":"181471279","full_name":"explosion/spacy-course","owner":"explosion","description":"👩‍🏫 Advanced NLP with spaCy: A free online course","archived":false,"fork":false,"pushed_at":"2025-02-07T07:51:14.000Z","size":9485,"stargazers_count":2358,"open_issues_count":13,"forks_count":376,"subscribers_count":59,"default_branch":"master","last_synced_at":"2025-04-14T15:01:02.225Z","etag":null,"topics":["binder","course","dependency-parsing","gatsby","gatsbyjs","jupyter","machine-learning","named-entity-recognition","natural-language-processing","nlp","online-course","part-of-speech-tagging","spacy","word-vectors"],"latest_commit_sha":null,"homepage":"https://course.spacy.io","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/explosion.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2019-04-15T11:17:06.000Z","updated_at":"2025-04-10T22:53:01.000Z","dependencies_parsed_at":"2024-11-29T14:15:58.953Z","dependency_job_id":"9cca3c45-6f6a-4866-940d-fc595e44dafe","html_url":"https://github.com/explosion/spacy-course","commit_stats":{"total_commits":691,"total_committers":53,"mean_commits":"13.037735849056604","dds":0.5151953690303908,"last_synced_commit":"f6cd4037da64658b2fb8ff6a54f622702a1d8946"},"previous_names":["ines/spacy-course"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/explosion%2Fspacy-course","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/explosion%2Fspacy-course/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/explosion%2Fspacy-course/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/explosion%2Fspacy-course/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/explosion","download_url":"https://codeload.github.com/explosion/spacy-course/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254310515,"owners_count":22049469,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["binder","course","dependency-parsing","gatsby","gatsbyjs","jupyter","machine-learning","named-entity-recognition","natural-language-processing","nlp","online-course","part-of-speech-tagging","spacy","word-vectors"],"created_at":"2024-07-30T19:00:49.291Z","updated_at":"2025-05-15T09:06:27.736Z","avatar_url":"https://github.com/explosion.png","language":"Python","readme":"# Advanced NLP with spaCy: A free online course\n\nThis repo contains both an [**online course**](https://course.spacy.io), as well\nas its modern open-source web framework. In the course, you'll learn how to use\n[spaCy](https://spacy.io) to build advanced natural language understanding\nsystems, using both rule-based and machine learning approaches. The front-end is\npowered by [Gatsby](http://gatsbyjs.org/), [Reveal.js](https://revealjs.com) and\n[Plyr](https://github.com/sampotts/plyr), and the back-end code execution uses\n[Binder](https://mybinder.org) 💖 It's all open-source and published under the\nMIT license (code and framework) and CC BY-NC (spaCy course materials).\n\n_This course is mostly intended for **self-study**. Yes, you can cheat – the\nsolutions are all in this repo, there's no penalty for clicking \"Show hints\" or\n\"Show solution\", and you can mark an exercise as done when you think it's done._\n\n[![Azure Pipelines](https://img.shields.io/azure-devops/build/explosion-ai/public/10/master.svg?logo=azure-devops\u0026style=flat-square)](https://dev.azure.com/explosion-ai/public/_build?definitionId=10)\n![Netlify Status](https://api.netlify.com/api/v1/badges/2eae6a1a-d7a3-437e-a700-61e32d7d991b/deploy-status)\n[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/explosion/spacy-course/master)\n\n## 💬 Languages and Translations\n\n| Language                                     | Text Examples\u003csup\u003e1\u003c/sup\u003e | Source                                                       | Authors                                                                                                                                                                                                                                                                                                                                                                                                                                              |\n| -------------------------------------------- | ------------------------- | ------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| **[English](https://course.spacy.io/en)**    | English                   | [`chapters/en`](chapters/en), [`exercises/en`](exercises/en) | [@ines](https://github.com/ines)                                                                                                                                                                                                                                                                                                                                                                                                                     |\n| **[German](https://course.spacy.io/de)**     | German                    | [`chapters/de`](chapters/de), [`exercises/de`](exercises/de) | [@ines](https://github.com/ines), [@Jette16](https://github.com/Jette16)                                                                                                                                                                                                                                                                                                                                                                             |\n| **[Spanish](https://course.spacy.io/es)**    | Spanish                   | [`chapters/es`](chapters/es), [`exercises/es`](exercises/es) | [@mariacamilagl](https://github.com/mariacamilagl), [@damian-romero](https://github.com/damian-romero)                                                                                                                                                                                                                                                                                                                                               |\n| **[French](https://course.spacy.io/fr)**     | French                    | [`chapters/fr`](chapters/fr), [`exercises/fr`](exercises/fr) | [@datakime](https://github.com/datakime)                                                                                                                                                                                                                                                                                                                                                                                                             |\n| **[Japanese](https://course.spacy.io/ja)**   | Japanese                  | [`chapters/ja`](chapters/ja), [`exercises/ja`](exercises/ja) | [@tamuhey](https://github.com/tamuhey), [@hiroshi-matsuda-rit](https://github.com/hiroshi-matsuda-rit), [@icoxfog417](https://github.com/icoxfog417), [@akirakubo](https://github.com/akirakubo), [@forest1988](https://github.com/forest1988), [@ao9mame](https://github.com/ao9mame), [@matsurih](https://github.com/matsurih), [@HiromuHota](https://github.com/HiromuHota), [@mei28](https://github.com/mei28), [@polm](https://github.com/polm) |\n| **[Chinese](https://course.spacy.io/zh)**    | Chinese                   | [`chapters/zh`](chapters/zh), [`exercises/zh`](exercises/zh) | [@crownpku](https://github.com/crownpku)                                                                                                                                                                                                                                                                                                                                                                                                             |\n| **[Portuguese](https://course.spacy.io/pt)** | English                   | [`chapters/pt`](chapters/pt), [`exercises/pt`](exercises/pt) | [@Cristianasp](https://github.com/Cristianasp)                                                                                                                                                                                                                                                                                                                                                                                                       |\n\nIf you spot a mistake, I always appreciate\n[pull requests](https://github.com/explosion/spacy-course/pulls)!\n\n**1.** This is the language used for the text examples and resources used in the\nexercises. For example, the German version of the course also uses German text\nexamples and models. It's not always possible to translate all code examples, so\nsome translations may still use and analyze English text as part of the course.\n\n### Related resources\n\n- 📚 **Prefer notebooks?** Check out\n  [the Jupyter notebook version](https://github.com/cristianasp/spacy) of this\n  course, put together by [@cristianasp](https://github.com/cristianasp).\n\n## 💁 FAQ\n\n#### Is this related to the spaCy course on DataCamp?\n\nI originally developed the content for DataCamp, but I wanted to make a free\nversion to make it available to more people, and so you don't have to sign up\nfor their service. As a weekend project, I ended up putting together my own\nlittle app to present the exercises and content in a fun and interactive way.\n\n#### Can I use this to build my own course?\n\nProbably, yes! If you've been looking for a DIY way to publish your materials, I\nhope that my little framework can be useful. Because so many people expressed\ninterest in this, I put together some starter repos that you can fork and adapt:\n\n- 🐍 Python:\n  [`ines/course-starter-python`](https://github.com/ines/course-starter-python)\n- 🇷 R: [`ines/course-starter-r`](https://github.com/ines/course-starter-r)\n\n#### Why the different licenses?\n\nThe source of the app, UI components and Gatsby framework for building\ninteractive courses is licensed as MIT, like pretty much all of my open-source\nsoftware. The course materials themselves (slides and chapters), are licensed\nunder CC BY-NC. This means that you can use them freely – you just can't make\nmoney off them.\n\n#### I want to help translate this course into my language. How can I contribute?\n\nFirst, thanks so much, this is really cool and valuable to the community 🙌 I've\ntried to set up the course structure so it's easy to add different languages:\nlanguage-specific files are organized into directories in\n[`exercises`](exercises) and [`chapters`](chapters), and other language specific\ntexts are available in [`locale.json`](locale.json). If you want to contribute,\nthere are two different ways to get involved:\n\n1. Start a community translation project. This is the easiest,\n   no-strings-attached way. You can fork the repo, copy-paste the English\n   version, change the\n   [language code](https://www.loc.gov/standards/iso639-2/php/code_list.php),\n   start translating and invite others to contribute (if you like). If you're\n   looking for contributors, feel free to open an issue here or tag\n   [@spacy_io](https://twitter.com/spacy_io) on Twitter so we can help get the\n   word out. We're also happy to answer your questions on the issue tracker.\n\n2. Make us an offer. We're open to commissioning translations for different\n   languages, so if you're interested, email us at\n   [contact@explosion.ai](mailto:contact@explosion.ai) and include your offer,\n   estimated time schedule and a bit about you and your background (and any\n   technical writing or translation work you've done in the past, if available).\n   It doesn't matter where you're based, but you should be able to issue\n   invoices as a freelancer or similar, depending on your country.\n\n#### I want to help create an audio/video tutorial for an existing translation. How can I get involved?\n\nAgain, thanks, this is super cool! While the\n[English](https://www.youtube.com/watch?v=THduWAnG97k) and\n[German](https://www.youtube.com/watch?v=K1elwpgDdls) videos also include a\nvideo recording, it's not a requirement and we'd be happy to just provide an\naudio track alongside the slides. We'd take care of the postprocessing and video\nediting, so all we need is the audio recording. If you feel comfortable\nrecording yourself reading out the slide notes in your language, email us at\n[contact@explosion.ai](mailto:contact@explosion.ai) and make us an offer and\ninclude a bit about you and similar work you've done in the past, if available.\n\n## 🎛 Usage \u0026 API\n\n### Running the app\n\nTo start the local development server, install [Gatsby](https://gatsbyjs.org)\nand then all other dependencies, then use `npm run dev` to start the development\nserver. Make sure you have at least Node 10.15 installed.\n\n```bash\nnpm install -g gatsby-cli  # Install Gatsby globally\nnpm install                # Install dependencies\nnpm run dev                # Run the development server\n```\n\nIf running with docker just run `make build` and then `make gatsby-dev`\n\n### How it works\n\nWhen building the site, Gatsby will look for `.py` files and make their contents\navailable to query via GraphQL. This lets us use the raw code within the app.\nUnder the hood, the app uses [Binder](https://mybinder.org) to serve up an image\nwith the package dependencies, including the spaCy models. By calling into\n[JupyterLab](https://jupyterlab.readthedocs.io/en/stable/), we can then execute\ncode using the active kernel. This lets you edit the code in the browser and see\nthe live results. Also see my [`juniper`](https://github.com/ines/juniper) repo\nfor more details on the implementation.\n\nTo validate the code when the user hits \"Submit\", I'm currently using a slightly\nhacky trick. Since the Python code is sent back to the kernel as a string, we\ncan manipulate it and add tests – for example, exercise `exc_01_02_01.py` will\nbe validated using `test_01_02_01.py` (if available). The user code and test are\ncombined using a string template. At the moment, the `testTemplate` in the\n`meta.json` looks like this:\n\n```\nfrom wasabi import msg\n__msg__ = msg\n__solution__ = \"\"\"${solution}\"\"\"\n${solution}\n\n${test}\ntry:\n    test()\nexcept AssertionError as e:\n    __msg__.fail(e)\n```\n\nIf present, `${solution}` will be replaced with the string value of the\nsubmitted user code. In this case, we're inserting it twice: once as a string so\nwe can check whether the submission includes something, and once as the code, so\nwe can actually run it and check the objects it creates. `${test}` is replaced\nby the contents of the test file. I'm also making\n[`wasabi`](https://github.com/ines/wasabi)'s printer available as `__msg__`, so\nwe can easily print pretty messages in the tests. Finally, the `try`/`accept`\nblock checks if the test function raises an `AssertionError` and if so, displays\nthe error message. This also hides the full error traceback (which can easily\nleak the correct answers).\n\nA test file could then look like this:\n\n```python\ndef test():\n    assert \"spacy.load\" in __solution__, \"Are you calling spacy.load?\"\n    assert nlp.meta[\"lang\"] == \"en\", \"Are you loading the correct model?\"\n    assert nlp.meta[\"name\"] == \"core_web_sm\", \"Are you loading the correct model?\"\n    assert \"nlp(text)\" in __solution__, \"Are you processing the text correctly?\"\n    assert \"print(doc.text)\" in __solution__, \"Are you printing the Doc's text?\"\n\n    __msg__.good(\n        \"Well done! Now that you've practiced loading models, let's look at \"\n        \"some of their predictions.\"\n    )\n```\n\nWith this approach, it's not _always_ possible to validate the input perfectly –\nthere are too many options and we want to avoid false positives.\n\n#### Running automated tests\n\nThe automated tests make sure that the provided solution code is compatible with\nthe test file that's used to validate submissions. The test suite is powered by\nthe [`pytest`](https://docs.pytest.org/en/latest/) framework and runnable test\nfiles are generated automatically in a directory `__tests__` before the test\nsession starts. See the [`conftest.py`](conftest.py) for implementation details.\n\n```bash\n# Install requirements\npip install -r binder/requirements.txt\n# Run the tests (will generate the files automatically)\npython -m pytest __tests__\n```\n\nIf running with docker just run `make build` and then `make pytest`\n\n### Directory Structure\n\n```yaml\n├── binder\n|   └── requirements.txt  # Python dependency requirements for Binder\n├── chapters              # chapters, grouped by language\n|   ├── en                # English chapters, one Markdown file per language\n|   |   └── slides        # English slides, one Markdown file per presentation\n|   └── ...               # other languages\n├── exercises             # code files, tests and assets for exercises\n|   ├── en                # English exercises, solutions, tests and data\n|   └── ...               # other languages\n├── public                # compiled site\n├── src                   # Gatsby/React source, independent from content\n├── static                # static assets like images, available in slides/chapters\n├── locale.json           # translations of meta and UI text\n├── meta.json             # course metadata\n└── theme.sass            # UI theme colors and settings\n```\n\n### Setting up Binder\n\nThe [`requirements.txt`](binder/requirements.txt) in the repository defines the\npackages that are installed when building it with Binder. For this course, I'm\nusing the source repo as the Binder repo, as it allows to keep everything in one\nplace. It also lets the exercises reference and load other files (e.g. JSON),\nwhich will be copied over into the Python environment. I build the binder from a\nbranch `binder`, though, which I only update if Binder-relevant files change.\nOtherwise, every update to `master` would trigger an image rebuild.\n\nYou can specify the binder settings like repo, branch and kernel type in the\n`\"juniper\"` section of the `meta.json`. I'd recommend running the very first\nbuild via the interface on the [Binder website](https://mybinder.org), as this\ngives you a detailed build log and feedback on whether everything worked as\nexpected. Enter your repository URL, click \"launch\" and wait for it to install\nthe dependencies and build the image.\n\n![Binder](https://user-images.githubusercontent.com/13643239/39412757-a518d416-4c21-11e8-9dad-8b4cc14737bc.png)\n\n### File formats\n\n#### Chapters\n\nChapters are placed in [`/chapters`](/chapters) and are Markdown files\nconsisting of `\u003cexercise\u003e` components. They'll be turned into pages, e.g.\n`/chapter1`. In their frontmatter block at the top of the file, they need to\nspecify `type: chapter`, as well as the following meta:\n\n```yaml\n---\ntitle: The chapter title\ndescription: The chapter description\nprev: /chapter1 # exact path to previous chapter or null to not show a link\nnext: /chapter3 # exact path to next chapter or null to not show a link\nid: 2 # unique identifier for chapter\ntype: chapter # important: this creates a standalone page from the chapter\n---\n\n```\n\n#### Slides\n\nSlides are placed in [`/slides`](/slides) and are markdown files consisting of\nslide content, separated by `---`. They need to specify the following\nfrontmatter block at the top of the file:\n\n```yaml\n---\ntype: slides\n---\n\n```\n\nThe **first and last slide** use a special layout and will display the headline\nin the center of the slide. **Speaker notes** (in this case, the script) can be\nadded at the end of a slide, prefixed by `Notes:`. They'll then be shown on the\nright next to the slides. Here's an example slides file:\n\n```markdown\n---\ntype: slide\n---\n\n# Processing pipelines\n\nNotes: This is a slide deck about processing pipelines.\n\n---\n\n# Next slide\n\n- Some bullet points here\n- And another bullet point\n\n\u003cimg src=\"/image.jpg\" alt=\"An image located in /static\" /\u003e\n```\n\n### Custom Elements\n\nWhen using custom elements, make sure to place a newline between the\nopening/closing tags and the children. Otherwise, Markdown content may not\nrender correctly.\n\n#### `\u003cexercise\u003e`\n\nContainer of a single exercise.\n\n| Argument     | Type            | Description                                                    |\n| ------------ | --------------- | -------------------------------------------------------------- |\n| `id`         | number / string | Unique exercise ID within chapter.                             |\n| `title`      | string          | Exercise title.                                                |\n| `type`       | string          | Optional type. `\"slides\"` makes container wider and adds icon. |\n| **children** | -               | The contents of the exercise.                                  |\n\n```markdown\n\u003cexercise id=\"1\" title=\"Introduction to spaCy\"\u003e\n\nContent goes here...\n\n\u003c/exercise\u003e\n```\n\n#### `\u003ccodeblock\u003e`\n\n| Argument     | Type            | Description                                                                                  |\n| ------------ | --------------- | -------------------------------------------------------------------------------------------- |\n| `id`         | number / string | Unique identifier of the code exercise.                                                      |\n| `source`     | string          | Name of the source file (without file extension). Defaults to `exc_${id}` if not set.        |\n| `solution`   | string          | Name of the solution file (without file extension). Defaults to `solution_${id}` if not set. |\n| `test`       | string          | Name of the test file (without file extension). Defaults to `test_${id}` if not set.         |\n| **children** | string          | Optional hints displayed when the user clicks \"Show hints\".                                  |\n\n```markdown\n\u003ccodeblock id=\"02_03\"\u003e\n\nThis is a hint!\n\n\u003c/codeblock\u003e\n```\n\n#### `\u003cslides\u003e`\n\nContainer to display slides interactively using Reveal.js and a Markdown file.\n\n| Argument | Type   | Description                                   |\n| -------- | ------ | --------------------------------------------- |\n| `source` | string | Name of slides file (without file extension). |\n\n```markdown\n\u003cslides source=\"chapter1_01_introduction-to-spacy\"\u003e\n\u003c/slides\u003e\n```\n\n#### `\u003cchoice\u003e`\n\nContainer for multiple-choice question.\n\n| Argument     | Type            | Description                                                                                  |\n| ------------ | --------------- | -------------------------------------------------------------------------------------------- |\n| `id`         | string / number | Optional unique ID. Can be used if more than one choice question is present in one exercise. |\n| **children** | nodes           | Only `\u003copt\u003e` components for the options.                                                     |\n\n```markdown\n\u003cchoice\u003e\n\n\u003copt text=\"Option one\"\u003eYou have selected option one! This is not good.\u003c/opt\u003e\n\u003copt text=\"Option two\" correct=\"true\"\u003eYay! \u003c/opt\u003e\n\n\u003c/choice\u003e\n```\n\n#### `\u003copt\u003e`\n\nA multiple-choice option.\n\n| Argument     | Type   | Description                                                                                    |\n| ------------ | ------ | ---------------------------------------------------------------------------------------------- |\n| `text`       | string | The option text to be displayed. Supports inline HTML.                                         |\n| `correct`    | string | `\"true\"` if the option is the correct answer.                                                  |\n| **children** | string | The text to be displayed if the option is selected (explaining why it's correct or incorrect). |\n","funding_links":[],"categories":["Python"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fexplosion%2Fspacy-course","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fexplosion%2Fspacy-course","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fexplosion%2Fspacy-course/lists"}