Commit a09c0346 authored by Sulfyderz's avatar Sulfyderz
Browse files

[New]:Adding 'reassignment' option in DualHumanAssisted method from Show and ShowCollection.

parent 194cc697
......@@ -3320,8 +3320,8 @@ class Show(object):
## delimitedOverlapMode: Pour savoir si on travaille avec des references et hypotheses qui contiennent des overlap (si present) délimité (overlap delimité = 1 segment qui represente une zone overlap)
## refNoOverlap: utiliser la reference brut ou la reference sans overlap
## actionsTime: recuperer les temps des actions
def createActionsDualHumanAssistedCorrectionFromDiarHacBic(self,boundaryRollingMean=False,boundaryRollingMean__winSize=100,boundaryRollingMean__maxSegSize=600,boundaryRollingMean__securityMarginSize=200,keepBoundary=False,modeTranscriber=False,uem=True,constrainedClustering=False,constrainedClustering__verbose=False,actionsIncremental=False,diarActionsHumanAssistedCorrection__clusterToDeleteAccordingToDiarRef={},diarIncrementalActionsHumanAssistedCorrection=False,delimitedOverlapMode=True,refNoOverlap=False,tolerance=0,actionsTime=False,reassignment__thr=None,reassignment__sr=False,reassignment__unifyReferenceModels=True,reassignment__unifyReferenceModels__weighed=False,reassignment__overlapIntoAccount=False,reassignment__toleranceIntoAccount=True,viterbi__window=None,viterbi__window__emission=False,viterbi__jumpOverSegmentsWithDuration=None,viterbi__giveBackControlToUser=False,viterbi__exit_penalties=[-250],viterbi__setUpSad=False,viterbi__applyUem=True,viterbi__loop_penalties=[0],viterbi__MetaData__FirstModel=False,viterbi__adjustBoundaries=False,viterbi__adjustBoundaries__pack=True,viterbi__noSpeech=False,viterbi__overlapIntoAccount=False,viterbi__toleranceIntoAccount=True,viterbi=True,verbose=False,indexIncremental=False,deleteBoundarySameConsecutiveSpk=False,deleteBoundaryMergeCluster=False):
assert isinstance(deleteBoundaryMergeCluster,bool) and isinstance(deleteBoundarySameConsecutiveSpk,bool) and isinstance(boundaryRollingMean__winSize,numbers.Number) and isinstance(boundaryRollingMean__securityMarginSize,numbers.Number) and isinstance(boundaryRollingMean__maxSegSize,numbers.Number) and isinstance(boundaryRollingMean,bool) and isinstance(keepBoundary,bool) and isinstance(modeTranscriber,bool) and isinstance(viterbi,bool) and isinstance(constrainedClustering__verbose,bool) and isinstance(constrainedClustering,bool) and isinstance(actionsIncremental,bool) and isinstance(uem,bool) and isinstance(refNoOverlap,bool) and isinstance(diarActionsHumanAssistedCorrection__clusterToDeleteAccordingToDiarRef,dict) and isinstance(diarIncrementalActionsHumanAssistedCorrection,bool) and isinstance(actionsTime,bool) and isinstance(delimitedOverlapMode,bool) and isinstance(tolerance,numbers.Number) and isinstance(verbose,bool) and isinstance(indexIncremental,bool)
def createActionsDualHumanAssistedCorrectionFromDiarHacBic(self,reassignment=True,boundaryRollingMean=False,boundaryRollingMean__winSize=100,boundaryRollingMean__maxSegSize=600,boundaryRollingMean__securityMarginSize=200,keepBoundary=False,modeTranscriber=False,uem=True,constrainedClustering=False,constrainedClustering__verbose=False,actionsIncremental=False,diarActionsHumanAssistedCorrection__clusterToDeleteAccordingToDiarRef={},diarIncrementalActionsHumanAssistedCorrection=False,delimitedOverlapMode=True,refNoOverlap=False,tolerance=0,actionsTime=False,reassignment__thr=None,reassignment__sr=False,reassignment__unifyReferenceModels=True,reassignment__unifyReferenceModels__weighed=False,reassignment__overlapIntoAccount=False,reassignment__toleranceIntoAccount=True,viterbi__window=None,viterbi__window__emission=False,viterbi__jumpOverSegmentsWithDuration=None,viterbi__giveBackControlToUser=False,viterbi__exit_penalties=[-250],viterbi__setUpSad=False,viterbi__applyUem=True,viterbi__loop_penalties=[0],viterbi__MetaData__FirstModel=False,viterbi__adjustBoundaries=False,viterbi__adjustBoundaries__pack=True,viterbi__noSpeech=False,viterbi__overlapIntoAccount=False,viterbi__toleranceIntoAccount=True,viterbi=True,verbose=False,indexIncremental=False,deleteBoundarySameConsecutiveSpk=False,deleteBoundaryMergeCluster=False):
assert isinstance(reassignment,bool) and isinstance(deleteBoundaryMergeCluster,bool) and isinstance(deleteBoundarySameConsecutiveSpk,bool) and isinstance(boundaryRollingMean__winSize,numbers.Number) and isinstance(boundaryRollingMean__securityMarginSize,numbers.Number) and isinstance(boundaryRollingMean__maxSegSize,numbers.Number) and isinstance(boundaryRollingMean,bool) and isinstance(keepBoundary,bool) and isinstance(modeTranscriber,bool) and isinstance(viterbi,bool) and isinstance(constrainedClustering__verbose,bool) and isinstance(constrainedClustering,bool) and isinstance(actionsIncremental,bool) and isinstance(uem,bool) and isinstance(refNoOverlap,bool) and isinstance(diarActionsHumanAssistedCorrection__clusterToDeleteAccordingToDiarRef,dict) and isinstance(diarIncrementalActionsHumanAssistedCorrection,bool) and isinstance(actionsTime,bool) and isinstance(delimitedOverlapMode,bool) and isinstance(tolerance,numbers.Number) and isinstance(verbose,bool) and isinstance(indexIncremental,bool)
for s in diarActionsHumanAssistedCorrection__clusterToDeleteAccordingToDiarRef:
assert isinstance(s,numbers.Number)
assert isinstance(diarActionsHumanAssistedCorrection__clusterToDeleteAccordingToDiarRef[s],list)
......@@ -4207,7 +4207,7 @@ class Show(object):
applyChange=False
if valueRef['cluster'] not in dictionary:
# si en presence d'un segment overlap et si la "not reassignment__overlapIntoAccount" est vrai alors on ne prend pas en compte les segments dans la réaffectation auto
if not reassignment__overlapIntoAccount and DiarTools.segmentWithinDiar(valueRef,diarOverlapArea):
if reassignment==False or (not reassignment__overlapIntoAccount and DiarTools.segmentWithinDiar(valueRef,diarOverlapArea)):
if valueTmp[z]['cluster'] in actionsAssignmentCreateThrBis:
# Application d'un viterbi à la prochaine iteration
alarmViterbi=True
......@@ -4374,7 +4374,7 @@ class Show(object):
actionsAssignmentChangeThr.append(copy.deepcopy([dictionary[valueRef['cluster']],valueTmp[z]]))
if actionsIncremental:
actionsIncrementalAssignmentChangeThrTurn.append(copy.deepcopy([dictionary[valueRef['cluster']],valueTmp[z]]))
if not reassignment__overlapIntoAccount and DiarTools.segmentWithinDiar(valueRef,diarOverlapArea):
if reassignment==False or (not reassignment__overlapIntoAccount and DiarTools.segmentWithinDiar(valueRef,diarOverlapArea)):
applyChange=True
else:
......
......@@ -287,13 +287,13 @@ class ShowCollection(object):
## refNoOverlap: utiliser la reference brut ou la reference sans overlap
## actionsTime: recuperer les temps des actions
## uem: apply or not the uem
def createActionsDualHumanAssistedCorrectionFromDiarHacBic(self,boundaryRollingMean=False,boundaryRollingMean__winSize=100,boundaryRollingMean__maxSegSize=600,boundaryRollingMean__securityMarginSize=200,keepBoundary=False,modeTranscriber=False,uem=True,constrainedClustering=False,constrainedClustering__verbose=False,actionsIncremental=False,diarActionsHumanAssistedCorrection__clusterToDeleteAccordingToDiarRef={},diarIncrementalActionsHumanAssistedCorrection=False,delimitedOverlapMode=True,refNoOverlap=False,tolerance=0,actionsTime=False,reassignment__thr=None,reassignment__sr=False,reassignment__unifyReferenceModels=True,reassignment__unifyReferenceModels__weighed=False,reassignment__overlapIntoAccount=False,reassignment__toleranceIntoAccount=True,viterbi=True,viterbi__applyUem=True,viterbi__jumpOverSegmentsWithDuration=None,viterbi__MetaData__FirstModel=False,viterbi__giveBackControlToUser=False,viterbi__window=None,viterbi__window__emission=False,viterbi__exit_penalties=[-250],viterbi__setUpSad=False,viterbi__loop_penalties=[0],viterbi__adjustBoundaries=False,viterbi__adjustBoundaries__pack=True,viterbi__noSpeech=False,viterbi__overlapIntoAccount=False,viterbi__toleranceIntoAccount=True,verbose=False,indexIncremental=False,deleteBoundarySameConsecutiveSpk=False,deleteBoundaryMergeCluster=False):
def createActionsDualHumanAssistedCorrectionFromDiarHacBic(self,reassignment=True,boundaryRollingMean=False,boundaryRollingMean__winSize=100,boundaryRollingMean__maxSegSize=600,boundaryRollingMean__securityMarginSize=200,keepBoundary=False,modeTranscriber=False,uem=True,constrainedClustering=False,constrainedClustering__verbose=False,actionsIncremental=False,diarActionsHumanAssistedCorrection__clusterToDeleteAccordingToDiarRef={},diarIncrementalActionsHumanAssistedCorrection=False,delimitedOverlapMode=True,refNoOverlap=False,tolerance=0,actionsTime=False,reassignment__thr=None,reassignment__sr=False,reassignment__unifyReferenceModels=True,reassignment__unifyReferenceModels__weighed=False,reassignment__overlapIntoAccount=False,reassignment__toleranceIntoAccount=True,viterbi=True,viterbi__applyUem=True,viterbi__jumpOverSegmentsWithDuration=None,viterbi__MetaData__FirstModel=False,viterbi__giveBackControlToUser=False,viterbi__window=None,viterbi__window__emission=False,viterbi__exit_penalties=[-250],viterbi__setUpSad=False,viterbi__loop_penalties=[0],viterbi__adjustBoundaries=False,viterbi__adjustBoundaries__pack=True,viterbi__noSpeech=False,viterbi__overlapIntoAccount=False,viterbi__toleranceIntoAccount=True,verbose=False,indexIncremental=False,deleteBoundarySameConsecutiveSpk=False,deleteBoundaryMergeCluster=False):
assert isinstance(diarActionsHumanAssistedCorrection__clusterToDeleteAccordingToDiarRef,dict)
for i in self.stock:
if len(diarActionsHumanAssistedCorrection__clusterToDeleteAccordingToDiarRef)!=0 and 'filenameSrc' in i.__dict__ and i.filenameSrc in diarActionsHumanAssistedCorrection__clusterToDeleteAccordingToDiarRef:
i.createActionsDualHumanAssistedCorrectionFromDiarHacBic(boundaryRollingMean=boundaryRollingMean,boundaryRollingMean__winSize=boundaryRollingMean__winSize,boundaryRollingMean__maxSegSize=boundaryRollingMean__maxSegSize,boundaryRollingMean__securityMarginSize=boundaryRollingMean__securityMarginSize,keepBoundary=keepBoundary,modeTranscriber=modeTranscriber,uem=uem,constrainedClustering=constrainedClustering,constrainedClustering__verbose=constrainedClustering__verbose,actionsIncremental=actionsIncremental,diarActionsHumanAssistedCorrection__clusterToDeleteAccordingToDiarRef=diarActionsHumanAssistedCorrection__clusterToDeleteAccordingToDiarRef[i.filenameSrc],diarIncrementalActionsHumanAssistedCorrection=diarIncrementalActionsHumanAssistedCorrection,delimitedOverlapMode=delimitedOverlapMode,refNoOverlap=refNoOverlap,tolerance=tolerance,actionsTime=actionsTime,reassignment__thr=reassignment__thr,reassignment__sr=reassignment__sr,reassignment__unifyReferenceModels=reassignment__unifyReferenceModels,reassignment__unifyReferenceModels__weighed=reassignment__unifyReferenceModels__weighed,reassignment__overlapIntoAccount=reassignment__overlapIntoAccount,reassignment__toleranceIntoAccount=reassignment__toleranceIntoAccount,viterbi=viterbi,viterbi__applyUem=viterbi__applyUem,viterbi__jumpOverSegmentsWithDuration=viterbi__jumpOverSegmentsWithDuration,viterbi__MetaData__FirstModel=viterbi__MetaData__FirstModel,viterbi__giveBackControlToUser=viterbi__giveBackControlToUser,viterbi__window=viterbi__window,viterbi__window__emission=viterbi__window__emission,viterbi__exit_penalties=viterbi__exit_penalties,viterbi__setUpSad=viterbi__setUpSad,viterbi__loop_penalties=viterbi__loop_penalties,viterbi__adjustBoundaries=viterbi__adjustBoundaries,viterbi__adjustBoundaries__pack=viterbi__adjustBoundaries__pack,viterbi__noSpeech=viterbi__noSpeech,viterbi__overlapIntoAccount=viterbi__overlapIntoAccount,viterbi__toleranceIntoAccount=viterbi__toleranceIntoAccount,verbose=verbose,indexIncremental=indexIncremental,deleteBoundarySameConsecutiveSpk=deleteBoundarySameConsecutiveSpk,deleteBoundaryMergeCluster=deleteBoundaryMergeCluster)
i.createActionsDualHumanAssistedCorrectionFromDiarHacBic(reassignment=reassignment,boundaryRollingMean=boundaryRollingMean,boundaryRollingMean__winSize=boundaryRollingMean__winSize,boundaryRollingMean__maxSegSize=boundaryRollingMean__maxSegSize,boundaryRollingMean__securityMarginSize=boundaryRollingMean__securityMarginSize,keepBoundary=keepBoundary,modeTranscriber=modeTranscriber,uem=uem,constrainedClustering=constrainedClustering,constrainedClustering__verbose=constrainedClustering__verbose,actionsIncremental=actionsIncremental,diarActionsHumanAssistedCorrection__clusterToDeleteAccordingToDiarRef=diarActionsHumanAssistedCorrection__clusterToDeleteAccordingToDiarRef[i.filenameSrc],diarIncrementalActionsHumanAssistedCorrection=diarIncrementalActionsHumanAssistedCorrection,delimitedOverlapMode=delimitedOverlapMode,refNoOverlap=refNoOverlap,tolerance=tolerance,actionsTime=actionsTime,reassignment__thr=reassignment__thr,reassignment__sr=reassignment__sr,reassignment__unifyReferenceModels=reassignment__unifyReferenceModels,reassignment__unifyReferenceModels__weighed=reassignment__unifyReferenceModels__weighed,reassignment__overlapIntoAccount=reassignment__overlapIntoAccount,reassignment__toleranceIntoAccount=reassignment__toleranceIntoAccount,viterbi=viterbi,viterbi__applyUem=viterbi__applyUem,viterbi__jumpOverSegmentsWithDuration=viterbi__jumpOverSegmentsWithDuration,viterbi__MetaData__FirstModel=viterbi__MetaData__FirstModel,viterbi__giveBackControlToUser=viterbi__giveBackControlToUser,viterbi__window=viterbi__window,viterbi__window__emission=viterbi__window__emission,viterbi__exit_penalties=viterbi__exit_penalties,viterbi__setUpSad=viterbi__setUpSad,viterbi__loop_penalties=viterbi__loop_penalties,viterbi__adjustBoundaries=viterbi__adjustBoundaries,viterbi__adjustBoundaries__pack=viterbi__adjustBoundaries__pack,viterbi__noSpeech=viterbi__noSpeech,viterbi__overlapIntoAccount=viterbi__overlapIntoAccount,viterbi__toleranceIntoAccount=viterbi__toleranceIntoAccount,verbose=verbose,indexIncremental=indexIncremental,deleteBoundarySameConsecutiveSpk=deleteBoundarySameConsecutiveSpk,deleteBoundaryMergeCluster=deleteBoundaryMergeCluster)
else:
i.createActionsDualHumanAssistedCorrectionFromDiarHacBic(boundaryRollingMean=boundaryRollingMean,boundaryRollingMean__winSize=boundaryRollingMean__winSize,boundaryRollingMean__maxSegSize=boundaryRollingMean__maxSegSize,boundaryRollingMean__securityMarginSize=boundaryRollingMean__securityMarginSize,keepBoundary=keepBoundary,modeTranscriber=modeTranscriber,uem=uem,constrainedClustering=constrainedClustering,constrainedClustering__verbose=constrainedClustering__verbose,actionsIncremental=actionsIncremental,diarActionsHumanAssistedCorrection__clusterToDeleteAccordingToDiarRef={},diarIncrementalActionsHumanAssistedCorrection=diarIncrementalActionsHumanAssistedCorrection,delimitedOverlapMode=delimitedOverlapMode,refNoOverlap=refNoOverlap,tolerance=tolerance,actionsTime=actionsTime,reassignment__thr=reassignment__thr,reassignment__sr=reassignment__sr,reassignment__unifyReferenceModels=reassignment__unifyReferenceModels,reassignment__unifyReferenceModels__weighed=reassignment__unifyReferenceModels__weighed,reassignment__overlapIntoAccount=reassignment__overlapIntoAccount,reassignment__toleranceIntoAccount=reassignment__toleranceIntoAccount,viterbi__exit_penalties=viterbi__exit_penalties,viterbi__setUpSad=viterbi__setUpSad,viterbi=viterbi,viterbi__applyUem=viterbi__applyUem,viterbi__jumpOverSegmentsWithDuration=viterbi__jumpOverSegmentsWithDuration,viterbi__MetaData__FirstModel=viterbi__MetaData__FirstModel,viterbi__giveBackControlToUser=viterbi__giveBackControlToUser,viterbi__window=viterbi__window,viterbi__window__emission=viterbi__window__emission,viterbi__loop_penalties=viterbi__loop_penalties,viterbi__adjustBoundaries=viterbi__adjustBoundaries,viterbi__adjustBoundaries__pack=viterbi__adjustBoundaries__pack,viterbi__noSpeech=viterbi__noSpeech,viterbi__overlapIntoAccount=viterbi__overlapIntoAccount,viterbi__toleranceIntoAccount=viterbi__toleranceIntoAccount,verbose=verbose,indexIncremental=indexIncremental,deleteBoundarySameConsecutiveSpk=deleteBoundarySameConsecutiveSpk,deleteBoundaryMergeCluster=deleteBoundaryMergeCluster)
i.createActionsDualHumanAssistedCorrectionFromDiarHacBic(reassignment=reassignment,boundaryRollingMean=boundaryRollingMean,boundaryRollingMean__winSize=boundaryRollingMean__winSize,boundaryRollingMean__maxSegSize=boundaryRollingMean__maxSegSize,boundaryRollingMean__securityMarginSize=boundaryRollingMean__securityMarginSize,keepBoundary=keepBoundary,modeTranscriber=modeTranscriber,uem=uem,constrainedClustering=constrainedClustering,constrainedClustering__verbose=constrainedClustering__verbose,actionsIncremental=actionsIncremental,diarActionsHumanAssistedCorrection__clusterToDeleteAccordingToDiarRef={},diarIncrementalActionsHumanAssistedCorrection=diarIncrementalActionsHumanAssistedCorrection,delimitedOverlapMode=delimitedOverlapMode,refNoOverlap=refNoOverlap,tolerance=tolerance,actionsTime=actionsTime,reassignment__thr=reassignment__thr,reassignment__sr=reassignment__sr,reassignment__unifyReferenceModels=reassignment__unifyReferenceModels,reassignment__unifyReferenceModels__weighed=reassignment__unifyReferenceModels__weighed,reassignment__overlapIntoAccount=reassignment__overlapIntoAccount,reassignment__toleranceIntoAccount=reassignment__toleranceIntoAccount,viterbi__exit_penalties=viterbi__exit_penalties,viterbi__setUpSad=viterbi__setUpSad,viterbi=viterbi,viterbi__applyUem=viterbi__applyUem,viterbi__jumpOverSegmentsWithDuration=viterbi__jumpOverSegmentsWithDuration,viterbi__MetaData__FirstModel=viterbi__MetaData__FirstModel,viterbi__giveBackControlToUser=viterbi__giveBackControlToUser,viterbi__window=viterbi__window,viterbi__window__emission=viterbi__window__emission,viterbi__loop_penalties=viterbi__loop_penalties,viterbi__adjustBoundaries=viterbi__adjustBoundaries,viterbi__adjustBoundaries__pack=viterbi__adjustBoundaries__pack,viterbi__noSpeech=viterbi__noSpeech,viterbi__overlapIntoAccount=viterbi__overlapIntoAccount,viterbi__toleranceIntoAccount=viterbi__toleranceIntoAccount,verbose=verbose,indexIncremental=indexIncremental,deleteBoundarySameConsecutiveSpk=deleteBoundarySameConsecutiveSpk,deleteBoundaryMergeCluster=deleteBoundaryMergeCluster)
# Pour chaque show: compte le nombre d'actions pour la correction sans Assisted (sans remise en question de la diarization apres chaque correction utilisateur)
def createActionsAssignmentHumanCorrectionCounter(self,average=False,modeTranscriber=False):
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment