Skip to content

Instantly share code, notes, and snippets.

@Syuparn
Last active November 2, 2018 07:16
Show Gist options
  • Save Syuparn/5085c3e107ab3481be2727d857ef0399 to your computer and use it in GitHub Desktop.
Save Syuparn/5085c3e107ab3481be2727d857ef0399 to your computer and use it in GitHub Desktop.
Praatの音声アノテーション(.TextGrid)を自動生成 ref: https://qiita.com/Syuparn/items/d86e77c39527539b16c5
$ julius --version
$ python convert_label.py path/to/dir
change segmentation unit to mora? (default:phoneme) y/n:
$ file -i sample.txt
sample.txt: text/plain; charset=utf-8
$ perl segment_julius.pl path/to/dir
$ python segment_recursively.py dir/to/path
$ python convert_label.py path/to/dir
change segmentation unit to mora? (default:phoneme) y/n:
0.0000000 0.1850000 silB
0.1850000 0.2745000 h
0.2745000 0.3870000 o
0.3870000 0.4455000 g
0.4455000 0.6415000 e
0.6410000 0.7097500 silE
File type = "ooTextFile"
Object class = "TextGrid"
xmin = 0
xmax = 0.7097500
tiers? <exists>
size = 1
item []:
item [1]:
class = "IntervalTier"
name = "phoneme"
xmin = 0
xmax = 0.7097500
intervals: size = 6
intervals [1]:
xmin = 0.0000000
xmax = 0.1850000
text = ""
intervals [2]:
xmin = 0.1850000
xmax = 0.2745000
text = "h"
intervals [3]:
xmin = 0.2745000
xmax = 0.3870000
text = "o"
intervals [4]:
xmin = 0.3870000
xmax = 0.4455000
text = "g"
intervals [5]:
xmin = 0.4455000
xmax = 0.6415000
text = "e"
intervals [6]:
xmin = 0.6410000
xmax = 0.7097500
text = ""
きょーわいいてんきだ
## data directory
if ($ARGV[0]){
$datadir = $ARGV[0];
} else {
$datadir = "./wav";
}
import os
import subprocess
import sys
args = sys.argv
for dirpath, dirnames, filenames in os.walk(args[1]):
subprocess.call(['perl', 'segment_julius.pl', dirpath])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment