{"id":15014174,"url":"https://github.com/sloev/spacy-syllables","last_synced_at":"2025-04-12T06:05:09.231Z","repository":{"id":54175355,"uuid":"247115287","full_name":"sloev/spacy-syllables","owner":"sloev","description":"Multilingual syllable annotation pipeline component for spacy","archived":false,"fork":false,"pushed_at":"2023-03-08T11:15:47.000Z","size":164,"stargazers_count":39,"open_issues_count":0,"forks_count":2,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-12T06:03:38.969Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/sloev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","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},"funding":{"github":["sloev"],"custom":["https://www.buymeacoffee.com/sloev"]}},"created_at":"2020-03-13T16:29:12.000Z","updated_at":"2025-01-03T09:38:23.000Z","dependencies_parsed_at":"2024-06-21T14:14:39.105Z","dependency_job_id":null,"html_url":"https://github.com/sloev/spacy-syllables","commit_stats":{"total_commits":23,"total_committers":5,"mean_commits":4.6,"dds":0.5652173913043479,"last_synced_commit":"753f2bde7830725dd5380ed8c87d12b03dbecc8d"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sloev%2Fspacy-syllables","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sloev%2Fspacy-syllables/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sloev%2Fspacy-syllables/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sloev%2Fspacy-syllables/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sloev","download_url":"https://codeload.github.com/sloev/spacy-syllables/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248525137,"owners_count":21118617,"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":[],"created_at":"2024-09-24T19:45:17.518Z","updated_at":"2025-04-12T06:05:09.165Z","avatar_url":"https://github.com/sloev.png","language":"Python","funding_links":["https://github.com/sponsors/sloev","https://www.buymeacoffee.com/sloev"],"categories":[],"sub_categories":[],"readme":"![spacy syllables](https://raw.githubusercontent.com/sloev/spacy-syllables/master/header.jpg)\n\n# Spacy Syllables\n\n![example workflow](https://github.com/sloev/spacy-syllables/actions/workflows/test.yml/badge.svg) [![Latest Version](https://img.shields.io/pypi/v/spacy-syllables.svg)](https://pypi.python.org/pypi/spacy-syllables) [![Python Support](https://img.shields.io/pypi/pyversions/spacy-syllables.svg)](https://pypi.python.org/pypi/spacy-syllables)\n\n\u003ca href=\"https://www.buymeacoffee.com/sloev\" target=\"_blank\"\u003e\u003cimg src=\"https://cdn.buymeacoffee.com/buttons/default-pink.png\" alt=\"Buy Me A Coffee\" height=\"51px\" width=\"217px\"\u003e\u003c/a\u003e\n\nA [spacy 2+ pipeline component](https://spacy.io/universe/category/pipeline) for adding multilingual syllable annotation to tokens. \n\n* Uses well established [pyphen](https://github.com/Kozea/Pyphen) for the syllables.\n* Supports [a ton of languages](https://github.com/Kozea/Pyphen/tree/master/pyphen/dictionaries)\n* Ease of use thx to the awesome pipeline framework in spacy\n\n## Install\n\n```bash\n$ pip install spacy_syllables\n```\n\nwhich also installs the following dependencies:\n\n* spacy = \"^2.2.3\"\n* pyphen = \"^0.9.5\"\n\n## Usage\n\nThe [`SpacySyllables`](spacy_syllables/__init__.py) class autodetects language from the given spacy nlp instance, but you can also override the detected language by specifying the `lang` parameter during instantiation, see how [here](tests/test_all.py).\n\n### Normal usecase\n\n```python\n\nimport spacy\nfrom spacy_syllables import SpacySyllables\n\nnlp = spacy.load(\"en_core_web_sm\")\n\nnlp.add_pipe(\"syllables\", after=\"tagger\")\n\nassert nlp.pipe_names == [\"tok2vec\", \"tagger\", \"syllables\", \"parser\", \"ner\", \"attribute_ruler\", \"lemmatizer\"]\n\ndoc = nlp(\"terribly long\")\n\ndata = [(token.text, token._.syllables, token._.syllables_count) for token in doc]\n\nassert data == [(\"terribly\", [\"ter\", \"ri\", \"bly\"], 3), (\"long\", [\"long\"], 1)]\n\n```\n\nmore examples in [tests](tests/test_all.py)\n\n## Migrating from spacy 2.x to 3.0\n\nIn spacy 2.x, spacy_syllables was originally added to the pipeline by instantiating a [`SpacySyllables`](spacy_syllables/__init__.py) object with the desired options and adding it to the pipeline: \n\n```python\nfrom spacy_syllables import SpacySyllables\n\nsyllables = SpacySyllables(nlp, \"en_US\")\n\nnlp.add_pipe(syllables, after=\"tagger\")\n```\n\nIn spacy 3.0, you now add the component to the pipeline simply by adding it by name, setting custom configuration information in the `add_pipe()` parameters:\n```python\nfrom spacy_syllables import SpacySyllables\n\nnlp.add_pipe(\"syllables\", after=\"tagger\", config={\"lang\": \"en_US\"})\n```\n\n\n\nIn addition, the default pipeline components have changed between 2.x and 3.0; please make sure to update any asserts you have that check for these.\ne.g.:\n\nspacy 2.x:\n```python\nassert nlp.pipe_names == [\"tagger\", \"syllables\", \"parser\", \"ner\"]\n```\n\nspacy 3.0:\n```python\nassert nlp.pipe_names == [\"tok2vec\", \"tagger\", \"syllables\", \"parser\", \"ner\", \"attribute_ruler\", \"lemmatizer\"]\n```\n\n## Dev setup / testing\n\n### install\n\ninstall the dev package and pyenv versions\n\n```bash\n$ pip install -e \".[dev]\"\n$ python -m spacy download en_core_web_sm\n```\n\n### run tests\n\n```bash\n$ black .\n$ pytest\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsloev%2Fspacy-syllables","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsloev%2Fspacy-syllables","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsloev%2Fspacy-syllables/lists"}