The library graf-python is an open source Python implementation to parse and write GrAF/XML files as described in ISO 24612. The parser of the library creates an annotation graph from the files. The user may then query the annotation graph via the API of graf-python.
gparser = graf.GraphParser()
graph = gparser.parse("filename.hdr") # Looping through the nodes
for node in graph.nodes():
Our documentation pages contain more examples how to access GrAF nodes and annotations via the API.
The graf-python source code is distributed under the Apache 2.0 License.
graf-python is also available on PyPI , so you can install via easy_install or pip:
$ easy_install graf-python
To install graf-python from the downloaded package you need to unpack the file and start "setup.py" on the command line. Change to the directory into which you downloaded the package and unpack it:
$ tar xzf graf-python-x.y.z.tar.gz $ cd graf-python-x.y.z
Then, to install the package locally into your python repository (you may need to have root privileges):
$ python setup.py install
Visit our documentation website.
The graf-python source code is hosted on Github.