Tools for converting data between different formats and RDF specification
Project description
ligttools
A collection of tools for converting IGT (Interlinear Glossed Text) data between different formats, including Ligt, an RDF specification.
Overview
ligttools is a Python library and collection of command-line tools for working with Interlinear Glossed Text in RDF. It provides utilities for converting data between various commonly used formats (ToolBox, FLEx, etc.) and RDF (Resource Description Framework) using Ligt vocabulary.
Installation
Install ligttools using pip:
git clone https://github.com/ligt-dev/ligttools.git
pip install .
After installing the package, a command-line tool ligt-convert
will be available in your system.
If you installed the package in a virtual environment, make sure the environment is activated before to use the tool.
For Developers
For development, we recommend using uv. To set up the environment:
# Clone the repository
git clone https://github.com/ligt-dev/ligttools.git
cd ligttools
uv sync
# For development dependencies (testing, etc.)
uv sync --extra dev
Available Tools
ligt-convert
A tool for converting data between common IGT data formats and RDF-based Ligt:
# Convert from CLDF to Ligt
ligt-convert -f cldf -t ligt input.json -o output.rdf
# Convert from Ligt to Toolbox
ligt-convert -f ligt -t toolbox input.rdf -o output.json
# You can also use long-form flags:
ligt-convert --from=cldf --to=ligt examples.csv --output=examples.ttl
# List supported formats
ligt-convert --list-formats
For advanced usage:
# Read from stdin (specify input format explicitly)
cat input.json | ligt-convert -f cldf -t ligt -o output.ttl
# Write to stdout (omit the output file)
ligt-convert -f cldf -t ligt examples.csv
# Specify RDF serialisation (default is Turtle)
ligt-convert -f cldf -t ligt.n3 examples.csv
Other tools (in development)
ligt-validate- Validates data against the Ligt schemaligt-query- Query RDF data using SPARQLligt-visualize- Visualizes linguistic data structures
Python API
You can also use LigtTools as a Python library:
from ligttools.converters import get_converter
# Convert JSON to RDF
cldf_converter = get_converter('cldf')
rdf_data = cldf_converter.to_rdf('examples.csv', 'output.ttl')
# Convert RDF to JSON
json_data = cldf_converter.from_rdf('input.ttl', 'output.csv')
# Get list of supported formats
from ligttools.converters import get_supported_formats
formats = get_supported_formats()
Supported Formats
Currently, ligttools supports the following formats:
- CLDF
- ToolBox
- FLExText
Extending ligttools
To add support for a new format:
- Create a new converter class that extends
BaseConverter - Implement the
to_rdfandfrom_rdfmethods - Register the converter using the registration function
Example:
from ligttools.converters.base import BaseConverter
from ligttools.converters import register_converter
class ELANConverter(BaseConverter):
def to_rdf(self, input_data, output_path=None):
# Implementation...
pass
def from_rdf(self, input_data, output_path=None):
# Implementation...
pass
# Register the converter
register_converter('xml', ELANConverter)
License
This software is licensed under the MIT License.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ligttools-0.2.3.tar.gz.
File metadata
- Download URL: ligttools-0.2.3.tar.gz
- Upload date:
- Size: 152.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
098ece9e96f736dd6492fc7dc1ce56a89e99f0c4831752c2d9dca824adb91277
|
|
| MD5 |
539d8b6d087c6a4646c59df07692d6ff
|
|
| BLAKE2b-256 |
aa0a15f4ed97ac4e789633f634ab11759cd370ade119898d00c9af4eaaa1503e
|
Provenance
The following attestation bundles were made for ligttools-0.2.3.tar.gz:
Publisher:
publish.yml on ligt-dev/ligttools
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ligttools-0.2.3.tar.gz -
Subject digest:
098ece9e96f736dd6492fc7dc1ce56a89e99f0c4831752c2d9dca824adb91277 - Sigstore transparency entry: 451152432
- Sigstore integration time:
-
Permalink:
ligt-dev/ligttools@cf720632274b986845d6fbb7c1c21aee20802fdf -
Branch / Tag:
refs/heads/main - Owner: https://github.com/ligt-dev
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@cf720632274b986845d6fbb7c1c21aee20802fdf -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file ligttools-0.2.3-py3-none-any.whl.
File metadata
- Download URL: ligttools-0.2.3-py3-none-any.whl
- Upload date:
- Size: 75.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
52382312604a08587759088399dad2b0ac92dcdf0d1ddcb38428dfda0916cf83
|
|
| MD5 |
727ee602fdf730596b38aa56e99971dd
|
|
| BLAKE2b-256 |
620df4e2859f723f8014240a12b8309aee1ce7737a6859f8a0f848b2d82db613
|
Provenance
The following attestation bundles were made for ligttools-0.2.3-py3-none-any.whl:
Publisher:
publish.yml on ligt-dev/ligttools
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ligttools-0.2.3-py3-none-any.whl -
Subject digest:
52382312604a08587759088399dad2b0ac92dcdf0d1ddcb38428dfda0916cf83 - Sigstore transparency entry: 451152442
- Sigstore integration time:
-
Permalink:
ligt-dev/ligttools@cf720632274b986845d6fbb7c1c21aee20802fdf -
Branch / Tag:
refs/heads/main - Owner: https://github.com/ligt-dev
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@cf720632274b986845d6fbb7c1c21aee20802fdf -
Trigger Event:
workflow_dispatch
-
Statement type: