Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
interface
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
homeostasis
interface
Commits
494a0602
Commit
494a0602
authored
10 years ago
by
Benoit Favre
Browse files
Options
Downloads
Patches
Plain Diff
add possibility to click lines of text to select them
parent
4cdc7e25
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
README
+5
-0
5 additions, 0 deletions
README
asr.py
+4
-3
4 additions, 3 deletions
asr.py
main.py
+13
-2
13 additions, 2 deletions
main.py
xmlview_widgets.py
+13
-6
13 additions, 6 deletions
xmlview_widgets.py
with
35 additions
and
11 deletions
README
+
5
−
0
View file @
494a0602
...
@@ -22,3 +22,8 @@ Todo:
...
@@ -22,3 +22,8 @@ Todo:
- use GtkSourceView to allow editing the xml file directly
- use GtkSourceView to allow editing the xml file directly
- model selection in config file
- model selection in config file
- integrate new xml with actions
- integrate new xml with actions
add model from mika
/storage/raid1/homedirs/mickael.rouvier/raid2/kaldi_english/exp/nnet2_online/
--acoustic-scale=.04166666666666666666
--endpoint.silence-phones=1:2:3:4:5:6:7:8:9:10:11:12:13:14:15:16:17:18:19:20:21:22:23:24:25:26:27:28:29:30:31:32:33:34:35
This diff is collapsed.
Click to expand it.
asr.py
+
4
−
3
View file @
494a0602
...
@@ -36,7 +36,7 @@ class ASR(Gtk.HBox):
...
@@ -36,7 +36,7 @@ class ASR(Gtk.HBox):
self
.
partial_hyp_callback
=
partial_hyp_callback
self
.
partial_hyp_callback
=
partial_hyp_callback
Thread
(
target
=
self
.
init_gst
).
start
()
Thread
(
target
=
self
.
init_gst
).
start
()
def
init_gst
(
self
):
def
init_gst
(
self
,
model
=
"
model2
"
):
"""
Initialize the speech components
"""
"""
Initialize the speech components
"""
GObject
.
idle_add
(
self
.
_started_loading_asr
)
GObject
.
idle_add
(
self
.
_started_loading_asr
)
...
@@ -54,9 +54,10 @@ class ASR(Gtk.HBox):
...
@@ -54,9 +54,10 @@ class ASR(Gtk.HBox):
if
not
os
.
path
.
isfile
(
model_file
):
if
not
os
.
path
.
isfile
(
model_file
):
print
>>
sys
.
stderr
,
"
Models not downloaded? Run prepare-models.sh first!
"
print
>>
sys
.
stderr
,
"
Models not downloaded? Run prepare-models.sh first!
"
sys
.
exit
(
1
)
sys
.
exit
(
1
)
self
.
asr
.
set_property
(
"
fst
"
,
"
asr/
model2
/HCLG.fst
"
)
self
.
asr
.
set_property
(
"
fst
"
,
"
asr/
%s
/HCLG.fst
"
%
model
)
self
.
asr
.
set_property
(
"
model
"
,
"
asr/final.mdl
"
)
self
.
asr
.
set_property
(
"
model
"
,
"
asr/final.mdl
"
)
self
.
asr
.
set_property
(
"
word-syms
"
,
"
asr/model2/words.txt
"
)
self
.
asr
.
set_property
(
"
word-syms
"
,
"
asr/%s/words.txt
"
%
model
)
#self.asr.set_property("acoustic-scale", 0.0416)
self
.
asr
.
set_property
(
"
feature-type
"
,
"
mfcc
"
)
self
.
asr
.
set_property
(
"
feature-type
"
,
"
mfcc
"
)
self
.
asr
.
set_property
(
"
mfcc-config
"
,
"
asr/conf/mfcc.conf
"
)
self
.
asr
.
set_property
(
"
mfcc-config
"
,
"
asr/conf/mfcc.conf
"
)
self
.
asr
.
set_property
(
"
ivector-extraction-config
"
,
"
asr/conf/ivector_extractor.fixed.conf
"
)
self
.
asr
.
set_property
(
"
ivector-extraction-config
"
,
"
asr/conf/ivector_extractor.fixed.conf
"
)
...
...
This diff is collapsed.
Click to expand it.
main.py
+
13
−
2
View file @
494a0602
...
@@ -65,9 +65,20 @@ class ScriptedASR(Gtk.Window):
...
@@ -65,9 +65,20 @@ class ScriptedASR(Gtk.Window):
style_provider
.
load_from_data
(
open
(
'
data/style.css
'
,
'
rb
'
).
read
())
style_provider
.
load_from_data
(
open
(
'
data/style.css
'
,
'
rb
'
).
read
())
Gtk
.
StyleContext
.
add_provider_for_screen
(
Gdk
.
Screen
.
get_default
(),
style_provider
,
Gtk
.
STYLE_PROVIDER_PRIORITY_APPLICATION
)
Gtk
.
StyleContext
.
add_provider_for_screen
(
Gdk
.
Screen
.
get_default
(),
style_provider
,
Gtk
.
STYLE_PROVIDER_PRIORITY_APPLICATION
)
for
line
in
self
.
lines
:
line
.
set_click_handler
(
self
.
line_clicked
)
def
line_clicked
(
self
,
widget
,
event
):
if
self
.
current_line
>=
0
:
self
.
lines
[
self
.
current_line
].
highlight
(
False
)
for
i
,
line
in
enumerate
(
self
.
lines
):
if
widget
is
line
:
self
.
current_line
=
i
self
.
lines
[
self
.
current_line
].
highlight
(
True
)
def
hyp_changed
(
self
,
hyp
):
def
hyp_changed
(
self
,
hyp
):
#hyp = ' '.join(hyp).replace('[noise]', ' ').split()
#hyp = ' '.join(hyp).replace('[noise]', ' ').split()
words
=
hyp
[
-
1
].
strip
().
split
()
words
=
hyp
[
-
1
].
strip
().
replace
(
'
_
'
,
'
'
).
split
()
if
self
.
current_line
>=
len
(
self
.
lines
)
-
1
:
if
self
.
current_line
>=
len
(
self
.
lines
)
-
1
:
print
"
FINISHED
"
print
"
FINISHED
"
return
return
...
@@ -92,7 +103,7 @@ class ScriptedASR(Gtk.Window):
...
@@ -92,7 +103,7 @@ class ScriptedASR(Gtk.Window):
if
__name__
==
'
__main__
'
:
if
__name__
==
'
__main__
'
:
xml_filename
=
'
data/homeostasis_
sept2014
.xml
'
xml_filename
=
'
data/homeostasis_
25nov
.xml
'
if
len
(
sys
.
argv
)
>
1
:
if
len
(
sys
.
argv
)
>
1
:
xml_filename
=
sys
.
argv
[
1
]
xml_filename
=
sys
.
argv
[
1
]
app
=
ScriptedASR
(
xml_filename
)
app
=
ScriptedASR
(
xml_filename
)
...
...
This diff is collapsed.
Click to expand it.
xmlview_widgets.py
+
13
−
6
View file @
494a0602
...
@@ -38,19 +38,26 @@ class Sequence(Gtk.VBox):
...
@@ -38,19 +38,26 @@ class Sequence(Gtk.VBox):
self
.
lines
.
append
(
Line
(
line
))
self
.
lines
.
append
(
Line
(
line
))
self
.
pack_start
(
self
.
lines
[
-
1
],
True
,
True
,
5
)
self
.
pack_start
(
self
.
lines
[
-
1
],
True
,
True
,
5
)
class
Line
(
Gtk
.
Label
):
class
Line
(
Gtk
.
EventBox
):
def
__init__
(
self
,
text
):
def
__init__
(
self
,
text
):
super
(
Line
,
self
).
__init__
()
super
(
Line
,
self
).
__init__
()
self
.
text
=
text
self
.
text
=
text
self
.
set_text
(
'
'
+
text
)
self
.
label
=
Gtk
.
Label
()
self
.
set_halign
(
Gtk
.
Align
.
START
)
self
.
label
.
set_text
(
'
'
+
text
)
self
.
get_style_context
().
add_class
(
'
text-line
'
)
self
.
label
.
set_halign
(
Gtk
.
Align
.
START
)
self
.
label
.
get_style_context
().
add_class
(
'
text-line
'
)
self
.
add
(
self
.
label
)
def
set_click_handler
(
self
,
handler
):
self
.
connect
(
'
button-press-event
'
,
handler
)
cursor
=
Gdk
.
Cursor
(
Gdk
.
CursorType
.
HAND1
)
self
.
get_window
().
set_cursor
(
cursor
)
def
highlight
(
self
,
highlighted
=
True
):
def
highlight
(
self
,
highlighted
=
True
):
if
highlighted
:
if
highlighted
:
self
.
get_style_context
().
add_class
(
'
highlighted
'
)
self
.
label
.
get_style_context
().
add_class
(
'
highlighted
'
)
else
:
else
:
self
.
get_style_context
().
remove_class
(
'
highlighted
'
)
self
.
label
.
get_style_context
().
remove_class
(
'
highlighted
'
)
class
Word
:
class
Word
:
def
__init__
(
self
,
text
,
start
,
end
):
def
__init__
(
self
,
text
,
start
,
end
):
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment