GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - kylebgorman/textgrid: A Python module for interacting with Praat TextGrid files. Also includes a class for reading HTK .mlf files into Praat

This repository was archived by the owner on Aug 22, 2024. It is now read-only.
BranchesTags
Open more actions menu

Latest commit

 

History

125 Commits
125 Commits

Folders and files

NameName
Last commit message
Last commit date
tests/data
tests/data
 
 
textgrid
textgrid
 
 
.gitignore
.gitignore
 
 
AUTHORS
AUTHORS
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
TODO
TODO
 
 
setup.py
setup.py
 
 
tests.py
tests.py
 
 

Repository files navigation

textgrid.py

Python classes for Praat TextGrid and TextTier files (and HTK .mlf files)

Kyle Gorman [email protected] and contributors (see commit history).

How to cite:

While you don't have to, if you want to cite textgrid.py in a publication, include a footnote link to the source:

http://github.com/kylebgorman/textgrid/

How to install:

The code can be placed in your working directory or in your $PYTHONPATH, and then imported in your Python script. You also can install it via pip, like so:

pip install textgrid

(if you're not working in a virtualenv, you may need to do this with sudo.)

Synopsis:

See the docstrings in textgrid.py

Example:

This is a simple example of reading a TextGrid file.

import textgrid

# Read a TextGrid object from a file.
tg = textgrid.TextGrid.fromFile('test.TextGrid')

# Read a IntervalTier object.
print("------- IntervalTier Example -------")
print(tg[0])
print(tg[0][0])
print(tg[0][0].minTime)
print(tg[0][0].maxTime)
print(tg[0][0].mark)

# Read a PointTier object.
print("------- PointTier Example -------")
print(tg[1])
print(tg[1][0])
print(tg[1][0].time)
print(tg[1][0].mark)

The content of the file test.TextGrid is as below:

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

xmin = 0
xmax = 1
tiers? <exists>
size = 2
item []:
    item [1]:
        class = "IntervalTier"
        name = "words"
        xmin = 0
        xmax = 1
        intervals: size = 2
        intervals [1]:
            xmin = 0
            xmax = 0.5
            text = """Is anyone home?"""
        intervals [2]:
            xmin = 0.5
            xmax = 1
            text = "asked ""Pat"""
    item [2]:
        class = "TextTier"
        name = "points"
        xmin = 0
        xmax = 1
        points: size = 2
        points [1]:
            number = 0.25
            mark = """event"""
        points [2]:
            number = 0.75
            mark = """event"" with quotes again"

The following is the output of the above snippet:

------- IntervalTier Example -------
<IntervalTier words, 2 intervals>
Interval(0.0, 0.5, "Is anyone home?")
0.0
0.5
"Is anyone home?"
------- PointTier Example -------
<PointTier points, 2 points>
Point(0.25, "event")
0.25
"event"

About

A Python module for interacting with Praat TextGrid files. Also includes a class for reading HTK .mlf files into Praat

Resources

Readme
MIT license
Activity

Stars

301 stars

Watchers

3 watching

Forks

61 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.