Spacy Syllables is a pipeline component that adds multilingual syllable annotations to Tokens. It uses Pyphen under the hood and has support for a long list of languages.
import spacy from spacy_syllables import SpacySyllables nlp = spacy.load('en_core_web_sm') syllables = SpacySyllables(nlp) nlp.add_pipe(syllables, after='tagger') doc = nlp('terribly long') data = [ (token.text, token._.syllables, token._.syllables_count) for token in doc ] assert data == [ ('terribly', ['ter', 'ri', 'bly'], 3), ('long', ['long'], 1) ]
Submit your project
If you have a project that you want the spaCy community to make use of, you can suggest it by submitting a pull request to the spaCy website repository. The Universe database is open-source and collected in a simple JSON file. For more details on the formats and available fields, see the documentation. Looking for inspiration your own spaCy plugin or extension? Check out the
project idea label on the issue tracker.