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.3.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.3-py3-none-any.whl (75.0 kB view details)

Uploaded Python 3

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

Hashes for ligttools-0.2.3.tar.gz
Algorithm Hash digest
SHA256 098ece9e96f736dd6492fc7dc1ce56a89e99f0c4831752c2d9dca824adb91277
MD5 539d8b6d087c6a4646c59df07692d6ff
BLAKE2b-256 aa0a15f4ed97ac4e789633f634ab11759cd370ade119898d00c9af4eaaa1503e

See more details on using hashes here.

Provenance

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

Hashes for ligttools-0.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 52382312604a08587759088399dad2b0ac92dcdf0d1ddcb38428dfda0916cf83
MD5 727ee602fdf730596b38aa56e99971dd
BLAKE2b-256 620df4e2859f723f8014240a12b8309aee1ce7737a6859f8a0f848b2d82db613

See more details on using hashes here.

Provenance

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