Giter VIP home page Giter VIP logo

textgrid's Introduction

textgrid

Version 0.2

A minimal python TextGrid module and CSV converter.

Tier labels are saved as a column called "tier". Points are treated as intervals with identical start and stop values.

Example input:

File type = "ooTextFile"
Object class = "TextGrid"

xmin = 0 
xmax = 4387.9766666666665 
tiers? <exists> 
size = 1
item []: 
    item [1]:
        class = "IntervalTier" 
        name = "Mary" 
        xmin = 0 
        xmax = 4387.9766666666665 
        intervals: size = 1
        intervals [1]:
            xmin = 0 
            xmax = 5.537098932314087 
            text = "z"

Example ouput using textgrid2csv example.TextGrid

start,stop,name,tier
0.0,5.537098932314087,z,Mary

installation

git clone https://github.com/kylerbrown/textgrid.git
cd textgrid
pip install .

# optional testing (requires pytest)
pytest -v

usage

usage: textgrid2csv [-h] [-o OUTPUT] [--sep SEP] [--noheader] [--savegaps]
                    TextGrid

convert a TextGrid file to a CSV.

positional arguments:
  TextGrid              a TextGrid file to process

optional arguments:
  -h, --help            show this help message and exit
  -o OUTPUT, --output OUTPUT
                        (optional) outputfile
  --sep SEP             separator to use in CSV output
  --noheader            no header for the CSV
  --savegaps            preserves intervals with no label

programmatic usage with Python and Pandas:

>>> import pandas as pd
>>> import textgrid
>>> tgrid = textgrid.read_textgrid("example.TextGrid")
>>> tgrid
[Entry(start=0.0, stop=5.537098932314087, name='z', tier='Mary')]
>>> pd.DataFrame(tgrid)
   start      stop name    tier
0      0  5.537099     z    Mary
>>> 

textgrid's People

Contributors

adefossez avatar kelvinxuande avatar kylerbrown avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

textgrid's Issues

About Setuptools

In file named setup.py
from setuptools import setup
what does this line corresonds?
there is no file or module named setuptools.
Similarly in textgrid.py module named collections

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.