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.4.tar.gz (152.8 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.4-py3-none-any.whl (75.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: ligttools-0.2.4.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

Hashes for ligttools-0.2.4.tar.gz
Algorithm Hash digest
SHA256 650bc894e251ebad15adafde6d08c83aa1f64a051f9fd6586a78a21924219236
MD5 661930009c70d116d2a7b88c35d4abda
BLAKE2b-256 4a5fdbf8e6ea110c51b0c181c64208aa7b5d013033ebd50c8058f9baa9429f05

See more details on using hashes here.

Provenance

The following attestation bundles were made for ligttools-0.2.4.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.4-py3-none-any.whl.

File metadata

  • Download URL: ligttools-0.2.4-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

Hashes for ligttools-0.2.4-py3-none-any.whl
Algorithm Hash digest
SHA256 497d6b5d7e9d7f65604dc22d7b897495ca0f2e5a6de34e22a035079b1ccf4562
MD5 5879c0810c9aa30a5f32c2e4888aadee
BLAKE2b-256 70a001c45723f06365f840b75efec8eea06208964e7faf41660690b267989e2e

See more details on using hashes here.

Provenance

The following attestation bundles were made for ligttools-0.2.4-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