{"id":9381,"library":"udapi","title":"UDAPI","description":"UDAPI is a Python framework for processing Universal Dependencies (UD) data, providing an API for reading, writing, and transforming CoNLL-U formatted treebanks. It supports tasks like visualization, format conversion, querying, and transformations of dependency trees. The library is actively maintained, with the current version being 0.5.2, and sees regular updates.","status":"active","version":"0.5.2","language":"en","source_language":"en","source_url":"https://github.com/udapi/udapi-python","tags":["NLP","Universal Dependencies","linguistics","parsing","treebank"],"install":[{"cmd":"pip install udapi","lang":"bash","label":"Install latest version"}],"dependencies":[{"reason":"Requires Python 3.9 or higher.","package":"python","optional":false},{"reason":"Optional: Needed for parsing functionality (e.g., `udapi.block.udpipe.udpipe` blocks). Not required for basic reading/writing/transformation.","package":"ufal.udpipe","optional":true}],"imports":[{"symbol":"Document","correct":"from udapi.core.document import Document"},{"symbol":"Block","correct":"from udapi.core.block import Block"},{"note":"Blocks are typically imported from `udapi.block.<category>.<BlockName>`.","wrong":"import Conllu","symbol":"Conllu","correct":"from udapi.block.read.conllu import Conllu"},{"symbol":"Text","correct":"from udapi.block.read.text import Text"}],"quickstart":{"code":"import io\nfrom contextlib import redirect_stdout\n\nfrom udapi.core.document import Document\nfrom udapi.block.read.text import Text\nfrom udapi.block.tokenize.simple import Simple\nfrom udapi.block.write.conllu import Conllu\n\n# Create a new document\ndoc = Document()\n\n# Read raw text into the document\nread_text_block = Text(string=\"This is a test sentence.\")\nread_text_block.apply_on_document(doc)\n\n# Tokenize the sentence using a simple whitespace tokenizer\ntokenize_block = Simple()\ntokenize_block.apply_on_document(doc)\n\n# Write the document in CoNLL-U format to a string\nf = io.StringIO()\nwith redirect_stdout(f):\n    write_conllu_block = Conllu()\n    write_conllu_block.apply_on_document(doc)\nconllu_output = f.getvalue()\n\nprint(conllu_output)","lang":"python","description":"This quickstart demonstrates how to initialize a `Document`, read a plain text sentence using `read.Text`, tokenize it with `tokenize.Simple`, and then write the resulting (unparsed) document into CoNLL-U format using `write.Conllu`. The output is captured and printed."},"warnings":[{"fix":"After installation, verify the `udapy` command is available by running `udapy -h`. If `command not found` occurs, ensure your `PATH` environment variable includes the directory where pip installs scripts (e.g., `~/.local/bin/`).","message":"Starting with version 0.5.2, the `udapy` CLI script transitioned to use `console_scripts` for invocation. While largely backward compatible, custom installations or environments that relied on specific `PATH` configurations might require verification.","severity":"breaking","affected_versions":">=0.5.2"},{"fix":"If you need parsing or other `udpipe`-dependent functionality, install it explicitly: `pip install --upgrade ufal.udpipe`.","message":"Many advanced processing blocks (e.g., for parsing or dependency tree transformations) rely on the `ufal.udpipe` library. This is an optional dependency and is not installed by default with `pip install udapi`.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Ensure your Python environment is 3.9 or newer. It is recommended to use a virtual environment with the correct Python version.","message":"UDAPI requires Python 3.9 or higher. Attempting to use it with older Python versions will result in runtime errors due to incompatible syntax or missing features.","severity":"gotcha","affected_versions":"<0.5.0 (Python 3.6+ was previously supported, but current versions require 3.9+)"}],"env_vars":null,"last_verified":"2026-04-16T00:00:00.000Z","next_check":"2026-07-15T00:00:00.000Z","problems":[{"fix":"Add the pip-installed scripts directory (usually `~/.local/bin`) to your `PATH` environment variable: `export PATH=\"$HOME/.local/bin/:$PATH\"`. You may also want to add this line to your shell's configuration file (e.g., `.bashrc` or `.zshrc`).","cause":"The `udapy` command-line script, installed by `pip`, is not in your system's `PATH` environment variable. This often happens with user-specific installations (`pip install --user`) if the local bin directory isn't added to PATH.","error":"command not found: udapy"},{"fix":"Install the `ufal.udpipe` library: `pip install --upgrade ufal.udpipe`.","cause":"You are trying to use a `udapi` block that relies on the `ufal.udpipe` library, but `ufal.udpipe` has not been installed. It is an optional dependency.","error":"ModuleNotFoundError: No module named 'ufal.udpipe'"},{"fix":"Upgrade your Python environment to version 3.9 or newer. Use a tool like `pyenv` or create a virtual environment with the correct Python version.","cause":"The Python version being used is older than the required Python 3.9. While the specific error might seem generic, it's often an underlying incompatibility with the required Python version.","error":"SyntaxError: invalid syntax (or similar errors like IndentationError) when running `udapi` code"}]}