{"id":5885,"library":"conllu","title":"CoNLL-U Parser","description":"The `conllu` library (version 6.0.0) is a Python parser for the CoNLL-U format, converting CoNLL-U formatted strings into a nested Python dictionary structure. CoNLL-U is frequently used as an output format for natural language processing tasks. It is actively maintained with a moderate release cadence and has no external dependencies.","status":"active","version":"6.0.0","language":"python","source_language":"en","source_url":"https://github.com/EmilStenstrom/conllu/","tags":["NLP","CoNLL-U","parser","natural language processing","linguistics"],"install":[{"cmd":"pip install conllu","lang":"bash","label":"Install stable version"}],"dependencies":[],"imports":[{"symbol":"parse","correct":"from conllu import parse"},{"symbol":"parse_tree","correct":"from conllu import parse_tree"}],"quickstart":{"code":"from conllu import parse\n\ndata = \"\"\"\n# text = The quick brown fox jumps over the lazy dog.\n1\tThe\tthe\tDET\tDT\tDefinite=Def|PronType=Art\t4\tdet\t_\t_\n2\tquick\tquick\tADJ\tJJ\tDegree=Pos\t4\tamod\t_\t_\n3\tbrown\tbrown\tADJ\tJJ\tDegree=Pos\t4\tamod\t_\t_\n4\tfox\tfox\tNOUN\tNN\tNumber=Sing\t5\tnsubj\t_\t_\n5\tjumps\tjump\tVERB\tVBZ\tMood=Ind|Number=Sing|Person=3|Tense=Pres|VerbForm=Fin\t0\troot\t_\t_\n6\tover\tover\tADP\tIN\t_\t9\tcase\t_\t_\n7\tthe\tthe\tDET\tDT\tDefinite=Def|PronType=Art\t9\tdet\t_\t_\n8\tlazy\tlazy\tADJ\tJJ\tDegree=Pos\t9\tamod\t_\t_\n9\tdog\tdog\tNOUN\tNN\tNumber=Sing\t5\tnmod\t_\tSpaceAfter=No\n10\t.\t.\tPUNCT\t.\t_\t5\tpunct\t_\t_\n\"\"\"\n\nsentences = parse(data)\n\n# Accessing tokens and metadata\nsentence = sentences[0]\nprint(f\"Sentence text: {sentence.metadata.get('text')}\")\nfor token in sentence:\n    print(f\"ID: {token['id']}, Form: {token['form']}, UPos: {token['upos']}\")\n","lang":"python","description":"Parses a CoNLL-U formatted string into a list of `TokenList` objects, each representing a sentence. Tokens can be accessed as dictionary-like objects, and sentence metadata is available via the `.metadata` attribute."},"warnings":[{"fix":"Upgrade to Python 3.8+ or pin `conllu<5.0.0`.","message":"Version 5.0 (and newer, including 6.0.0) requires Python 3.8 or higher. Projects running on Python 3.6 or 3.7 must upgrade their Python version or pin `conllu` to a version older than 5.0.","severity":"breaking","affected_versions":">=5.0.0"},{"fix":"Update token field access from `token['xpostag']` to `token['xpos']` and `token['upostag']` to `token['upos']`.","message":"In version 3.0, the field names `xpostag` and `upostag` were changed to `xpos` and `upos` respectively, to align with Universal Dependencies 2.0. While `conllu` provides aliasing for backward compatibility, it's recommended to update code to use `xpos` and `upos` for clarity and future compatibility.","severity":"gotcha","affected_versions":">=3.0.0"},{"fix":"Review the official migration guides for versions 0.1 to 1.0 on the PyPI project page or GitHub repository for detailed code changes required.","message":"Updating from very old versions (e.g., 0.1 to 1.0) involved significant breaking changes to the API. Users migrating from such old versions should consult the release notes for a comprehensive upgrade guide.","severity":"breaking","affected_versions":"0.1.x to 1.x.x"}],"env_vars":null,"search_vec":"'6.0.0':9 'activ':49 'cadenc':55 'conll':2,17,22,33,63 'conll-u':1,16,21,32,62 'conllu':6 'convert':20 'depend':60 'dictionari':30 'extern':59 'format':19,24,41 'frequent':36 'languag':44,67 'librari':7 'linguist':69 'maintain':50 'moder':53 'natur':43,66 'nest':28 'nlp':61 'output':40 'parser':4,13,65 'process':45,68 'python':12,29 'releas':54 'string':25 'structur':31 'task':46 'u':3,18,23,34,64 'use':37 'version':8","created_at":"2026-04-14T18:32:40.509352+00:00","updated_at":"2026-04-16T03:36:24.346989+00:00","problems":[{"fix":"Install the library using pip: `pip install conllu`","cause":"The `conllu` library has not been installed in your Python environment or the environment where your script is being run.","error":"ModuleNotFoundError: No module named 'conllu'"},{"fix":"Inspect your CoNLL-U file around the indicated token or line to ensure it has exactly 10 tab-separated columns for each token line, blank lines for sentence boundaries, and comment lines starting with `#`. Ensure no lines are truncated or contain unexpected characters. For custom formats, consider using `conllu.parse(data, fields=...)` with a custom `fields` definition.","cause":"This error occurs when the input CoNLL-U data does not strictly adhere to the expected 10-column format, or a line is malformed, preventing the parser from correctly extracting all fields for a token. The index `X` indicates which column was expected but not found.","error":"ValueError: Missing column at index X for token Y"},{"fix":"Iterate through the list of `TokenList` objects and call `.serialize()` on each individual `TokenList`, or if you parsed a single sentence, access the first element: `sentences = parse(data)`; `sentence_string = sentences[0].serialize()`.","cause":"The `conllu.parse()` function returns a list of `TokenList` objects when parsing multiple sentences. You are attempting to call the `.serialize()` method, which exists on a `TokenList` object, directly on the Python list containing these `TokenList` objects.","error":"AttributeError: 'list' object has no attribute 'serialize'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"6.0.0","cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/EmilStenstrom/conllu","docs":null,"changelog":null,"pypi":"https://pypi.org/project/conllu/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["ai-ml","serialization","data"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-06-28","last_verified":"2026-06-28","next_check":"2026-07-28","install_tag":null}}