Skip to main content

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 schema
  • ligt-query - Query RDF data using SPARQL
  • ligt-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:

  1. Create a new converter class that extends BaseConverter
  2. Implement the to_rdf and from_rdf methods
  3. 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

ligttools-0.2.2.tar.gz (152.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ligttools-0.2.2-py3-none-any.whl (74.9 kB view details)

Uploaded Python 3

File details

Details for the file ligttools-0.2.2.tar.gz.

File metadata

  • Download URL: ligttools-0.2.2.tar.gz
  • Upload date:
  • Size: 152.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for ligttools-0.2.2.tar.gz
Algorithm Hash digest
SHA256 f41bd29b7e839b8700fd44630bfab5aa08741d8bc173722b94cb18b079ef6d8a
MD5 653b95ee2885f558eb3ae3a2a3968c8d
BLAKE2b-256 8f77353924adb12bd1f5b323f2b9c5d828bb3d1f98c06c12ed907f78922eb65c

See more details on using hashes here.

Provenance

The following attestation bundles were made for ligttools-0.2.2.tar.gz:

Publisher: publish.yml on ligt-dev/ligttools

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ligttools-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: ligttools-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 74.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for ligttools-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 6df60afe1e3e20aeb08939704a341f25c7d8f13d263fff5b0dd4021e8f3423eb
MD5 a15ae67e6254dac8df6aa8df5e9cb784
BLAKE2b-256 3b9dcfd2d5fc939ab7cc9d15b385fe720f81711da47cfd14ab8a806170a2d05c

See more details on using hashes here.

Provenance

The following attestation bundles were made for ligttools-0.2.2-py3-none-any.whl:

Publisher: publish.yml on ligt-dev/ligttools

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page