Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
Signed-off-by: Philip Abbet <[email protected]>
  • Loading branch information
nantonel authored and Kanma committed Feb 26, 2021
0 parents commit 5e9026a
Show file tree
Hide file tree
Showing 24 changed files with 2,446 additions and 0 deletions.
37 changes: 37 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
__pycache__
*.pt
*.log
*.swp
*.gz
*.pdf
*.log
*.bbl
*.blg
*.aux
*.auxlock
*.dpth
*.md5
*.dep
*.table
*.dvi
*.gnuplot
*.fdb_latexmk
*.fls
*.out
*.spl
*.nav
*.toc
*.snm
*.jld2
*.bson
.DS_Store
_cache_*

data/
models/
logs/
figs/
checkpoint/
evals/
env.sh
jl_*
43 changes: 43 additions & 0 deletions DatasetParsers.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Copyright (c) 2021 Idiap Research Institute, http://www.idiap.ch/
# Niccolò Antonello <[email protected]>

export get_uttID2file
function get_uttID2file(dataset_path,folder::String)
uttID2file = Dict{String,String}()
for (root,dir,files) in walkdir(joinpath(dataset_path,folder);follow_symlinks=true)
wavs = files[findall(contains.(files,".wav"))]
folders = split(root, "/")
spkID = folders[end]
type = folders[end-1]
for f in wavs
sentenceID = split(f, "."; limit=2)[1]
uttID = "$(spkID)-$(type)-$(sentenceID)"
uttID2file[uttID] = joinpath(root,f)
end
end
return uttID2file
end

export get_uttID2text
function get_uttID2text(uttID2file::Dict)
d = Dict(
'z' => "ZERO", '3' => "THREE", '7' => "SEVEN",
'o' => "OH", '4' => "FOUR", '8' => "EIGHT",
'1' => "ONE", '5' => "FIVE", '9' => "NINE",
'2' => "TWO", '6' => "SIX", 'a' =>"", 'b'=>"")
uttID2text = Dict{String,String}()
for uttID in keys(uttID2file)
text = split(uttID,"-")[3]
try
uttID2text[uttID] = strip(prod([d[t] for t in text].*" "))
catch
error("$text is an invalid filename, invalid dataset!")
end
end
return uttID2text
end

function get_uttID2wav(uttID2file::Dict; T=Float32)
uttID2wav = Dict(uttID => T.(load(uttID2file[uttID]).data)[:]
for uttID in keys(uttID2file))
end
22 changes: 22 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
MIT License

Copyright (c) 2021 Idiap Research Institute, http://www.idiap.ch/
Written by Niccolò Antonello <[email protected]>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Loading

0 comments on commit 5e9026a

Please sign in to comment.