Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Pierre-Alexandre Broux
s4dl
Commits
93cd0782
Commit
93cd0782
authored
Apr 26, 2018
by
Sulfyderz
Browse files
Test: ON
parent
ea822ed4
Changes
1
Hide whitespace changes
Inline
Side-by-side
s4dl/Show.py
View file @
93cd0782
...
...
@@ -3484,6 +3484,11 @@ class Show(object):
# ATTENTION: Chaque condition considere que la frontiere "start" est validé/correcte (a été modifié à l'itération précédente si besoin il y a eu), quel ne dépasse pas le segment de ref
# VITERBI
print
(
"SAME #VIN:"
,
DiarTools
.
sameDiar
(
value
,
DiarTools
.
releaseFramesAccordingToDiar
(
diarRef
,
value
)))
if
not
DiarTools
.
sameDiar
(
value
,
DiarTools
.
releaseFramesAccordingToDiar
(
diarRef
,
value
)):
print
(
value
)
print
(
DiarTools
.
releaseFramesAccordingToDiar
(
diarRef
,
value
))
sys
.
exit
()
if
viterbi
and
((
alarmViterbi
==
True
and
alarmViterbiValue
is
None
)
or
(
alarmViterbi
==
True
and
alarmViterbiValue
is
not
None
and
alarmViterbiValue
<=
diarRef
[
i
-
1
][
'start'
]
+
tolerance
)):
alarmViterbi
=
False
alarmViterbiValue
=
None
...
...
@@ -3542,7 +3547,7 @@ class Show(object):
if
len
(
diarCheckedTmpBis
)
!=
0
and
((
viterbi__jumpOverSegmentsWithDuration
is
not
None
and
valueRef
.
duration
()
>
viterbi__jumpOverSegmentsWithDuration
)
or
viterbi__jumpOverSegmentsWithDuration
is
None
):
valueToLearn
=
DiarTools
.
mergeDiar
(
diar1
=
diarCheckedTmpBis
,
diar2
=
diarUncheckedTmp
,
sort
=
True
)
print
(
"UHUHU"
)
hmm
=
HumanAssistedViterbi
(
self
.
cepstrum
,
valueToLearn
,
exit_penalties
=
viterbi__exit_penalties
,
loop_penalties
=
viterbi__loop_penalties
,
adjustBoundaries
=
viterbi__adjustBoundaries
,
adjustBoundaries__pack
=
viterbi__adjustBoundaries__pack
)
if
actionsTime
or
viterbi__giveBackControlToUser
:
...
...
@@ -3662,7 +3667,13 @@ class Show(object):
# Stocke chaque diar apres chaque interaction humaine
if
diarIncrementalActionsHumanAssistedCorrection
and
i
!=
0
:
diarIncrementalThr
.
append
(
copy
.
deepcopy
(
value
))
diarIncrementalThr
.
append
(
copy
.
deepcopy
(
value
))
print
(
"SAME #VOUT:"
,
DiarTools
.
sameDiar
(
value
,
DiarTools
.
releaseFramesAccordingToDiar
(
diarRef
,
value
)))
if
not
DiarTools
.
sameDiar
(
value
,
DiarTools
.
releaseFramesAccordingToDiar
(
diarRef
,
value
)):
print
(
value
)
print
(
DiarTools
.
releaseFramesAccordingToDiar
(
diarRef
,
value
))
sys
.
exit
()
# SELECTIONNE TOUS LES SEGMENTS HYPOTHESES AVANT LE PREMIER SEGMENT DE REFERENCE (signifie mal classé car silence coté ref)
if
i
==
0
:
...
...
@@ -3824,6 +3835,7 @@ class Show(object):
if
u
[
'start'
]
>=
(
valueRef
[
'stop'
]
-
tolerance
)
and
u
[
'stop'
]
<=
(
valueRef
[
'stop'
]
+
tolerance
):
# Aucune action, tous les segments dans cet interval sont supprimés
valueTmp
=
DiarTools
.
dropSegment
(
u
,
valueTmp
)
print
(
"!!!!!!!!!!!!!!!!!!!!!!!!!!!alarm2"
)
alarmViterbi
=
True
elif
u
[
'start'
]
>=
(
valueRef
[
'stop'
]
+
tolerance
):
break
...
...
@@ -3856,11 +3868,17 @@ class Show(object):
valueTmp
=
DiarTools
.
addSegment
(
dictionary
[
valueRef
[
'cluster'
]],
'speaker'
,
valueRef
[
'start'
],
valueRef
[
'stop'
],
valueTmp
)
# Application d'un viterbi à la prochaine iteration
print
(
"!!!!!!!!!!!!!!!!!!!!!!!!!!!alarm3"
)
alarmViterbi
=
True
# si 1 alors affectation + move bound si besoin/et ou create bound sur stop
# si > 1 alors affectation + move bound si besoin/et ou create bound sur stop + merge
else
:
print
(
"SAME #1:"
,
DiarTools
.
sameDiar
(
valueTmp
,
DiarTools
.
releaseFramesAccordingToDiar
(
diarRef
,
valueTmp
)))
if
not
DiarTools
.
sameDiar
(
valueTmp
,
DiarTools
.
releaseFramesAccordingToDiar
(
diarRef
,
valueTmp
)):
print
(
valueTmp
)
print
(
DiarTools
.
releaseFramesAccordingToDiar
(
diarRef
,
valueTmp
))
sys
.
exit
()
# verifie que la valueRef ne se trouve pas recouvert par la tolerance
if
not
DiarTools
.
segmentExistsAccordingToTolerance
(
valueRef
,
tolerance
):
for
z
in
listHypRefSegment
:
...
...
@@ -3870,6 +3888,7 @@ class Show(object):
valueTmp
=
DiarTools
.
dropSegment
(
z
,
valueTmp
)
#alarmViterbi=True
elif
z
[
'start'
]
>=
(
valueRef
[
'start'
]
-
tolerance
)
and
z
[
'stop'
]
>
(
valueRef
[
'stop'
]
+
tolerance
):
#and z['start']<(valueRef['stop']-tolerance):
# partie permettant de savoir si on coupe le segment ou le detruit directement
stopTmp
=
None
for
u
in
range
(
i
+
1
,
len
(
diarRef
)):
...
...
@@ -3898,7 +3917,7 @@ class Show(object):
actionsSegmentationSegmentDeleteThr
.
append
(
copy
.
deepcopy
(
zTmp
))
if
actionsIncremental
:
actionsIncrementalSegmentationSegmentDeleteThrTurn
.
append
(
copy
.
deepcopy
(
zTmp
))
alarmViterbiValue
=
zTmp
[
'stop'
]
#
alarmViterbiValue=zTmp['stop']
valueTmp
=
DiarTools
.
dropSegment
(
zTmp
,
valueTmp
)
break
else
:
...
...
@@ -3907,7 +3926,7 @@ class Show(object):
actionsSegmentationSegmentDeleteThr
.
append
(
copy
.
deepcopy
(
z
))
if
actionsIncremental
:
actionsIncrementalSegmentationSegmentDeleteThrTurn
.
append
(
copy
.
deepcopy
(
z
))
alarmViterbiValue
=
z
[
'stop'
]
#
alarmViterbiValue=z['stop']
valueTmp
=
DiarTools
.
dropSegment
(
z
,
valueTmp
)
#alarmViterbi=True
#elif z['start']>=(valueRef['stop']-tolerance):
...
...
@@ -3933,6 +3952,7 @@ class Show(object):
perfectBoundary
=
True
else
:
# Application d'un viterbi à la prochaine iteration
print
(
"!!!!!!!!!!!!!!!!!!!!!!!!!!!alarm4"
)
alarmViterbi
=
True
if
not
perfectBoundary
:
...
...
@@ -4156,7 +4176,7 @@ class Show(object):
reassignment__thrValue
=
reassignment__thr
else
:
reassignment__thrValue
=
key
print
(
"OHLALA"
)
if
not
constrainedClustering
:
if
actionsTime
:
t1
=
time
.
time
()
...
...
@@ -4376,7 +4396,11 @@ class Show(object):
if
actionsIncremental
:
actionsIncrementalSegmentationBoundaryMergeThrTurn
.
append
(
copy
.
deepcopy
([
newSegment
,
listTmp
[
y
]]))
newSegment
,
valueTmp
=
DiarTools
.
mergeSegment
(
newSegment
,
listTmp
[
y
],
valueTmp
)
print
(
"SAME #2:"
,
DiarTools
.
sameDiar
(
valueTmp
,
DiarTools
.
releaseFramesAccordingToDiar
(
diarRef
,
valueTmp
)))
if
not
DiarTools
.
sameDiar
(
valueTmp
,
DiarTools
.
releaseFramesAccordingToDiar
(
diarRef
,
valueTmp
)):
print
(
valueTmp
)
print
(
DiarTools
.
releaseFramesAccordingToDiar
(
diarRef
,
valueTmp
))
sys
.
exit
()
# MAJ diar
value
=
valueTmp
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment