Commit d251222f authored by Sulfyderz's avatar Sulfyderz
Browse files

[Error Update]:Improving the automaton methods.

parent b95c728c
......@@ -496,6 +496,14 @@ def automatonSegmentation(diarHyp,diarRef,diarUem=None,tolerance=0,modeNoGap=Fal
else:
# Allows to know whether we do treatments for segments with wrong boundaries
perfectBoundary=False
listHypRefSegment=list()
for y in valueTmp:
if Segment.intersection(y,valueRef) is not None:
if tolerance==0:
listHypRefSegment.append(y)
elif tolerance!=0 and y['start']>=(valueRef['start']-tolerance):
if not y['start']>=(valueRef['stop']-tolerance):
listHypRefSegment.append(y)
# Checks perfect boundary
if len(listHypRefSegment)==1 and boundariesInTolerance(boundarySegment=listHypRefSegment[0],segment=valueRef,tolerance=tolerance):
actionsSegmentationNothing.append(copy.deepcopy(listHypRefSegment[0]))
......@@ -504,11 +512,10 @@ def automatonSegmentation(diarHyp,diarRef,diarUem=None,tolerance=0,modeNoGap=Fal
if not perfectBoundary:
for z in listHypRefSegment:
# We cut if boundary not ok to stay in the reference segment
if z['stop']>(valueRef['stop']+tolerance):
if not z['start']>=(valueRef['stop']-tolerance):
actionsSegmentationBoundaryCreate.append(copy.deepcopy([z,valueRef['stop']]))
actionsIncrementalSegmentationBoundaryCreateTurn.append(copy.deepcopy([z,valueRef['stop']]))
valueTmp=splitSegment(z,valueTmp,valueRef['stop'])
if z['stop']>(valueRef['stop']+tolerance):
actionsSegmentationBoundaryCreate.append(copy.deepcopy([z,valueRef['stop']]))
actionsIncrementalSegmentationBoundaryCreateTurn.append(copy.deepcopy([z,valueRef['stop']]))
valueTmp=splitSegment(z,valueTmp,valueRef['stop'])
if tolerance!=0:
valueTmp2=copy.deepcopy(valueTmp)
for u in valueTmp2:
......@@ -1027,6 +1034,14 @@ def automatonSegmentationAssignment(diarHyp,diarRef,diarUem=None,tolerance=0,mod
else:
# Allows to know whether we do treatments for segments with wrong boundaries
perfectBoundary=False
listHypRefSegment=list()
for y in valueTmp:
if Segment.intersection(y,valueRef) is not None:
if tolerance==0:
listHypRefSegment.append(y)
elif tolerance!=0 and y['start']>=(valueRef['start']-tolerance):
if not y['start']>=(valueRef['stop']-tolerance):
listHypRefSegment.append(y)
# Checks perfect boundary
if len(listHypRefSegment)==1 and boundariesInTolerance(boundarySegment=listHypRefSegment[0],segment=valueRef,tolerance=tolerance):
actionsSegmentationNothing.append(copy.deepcopy(listHypRefSegment[0]))
......@@ -1036,10 +1051,9 @@ def automatonSegmentationAssignment(diarHyp,diarRef,diarUem=None,tolerance=0,mod
for z in listHypRefSegment:
# We cut if boundary not ok to stay in the reference segment
if z['stop']>(valueRef['stop']+tolerance):
if not z['start']>=(valueRef['stop']-tolerance):
actionsSegmentationBoundaryCreate.append(copy.deepcopy([z,valueRef['stop']]))
actionsIncrementalSegmentationBoundaryCreateTurn.append(copy.deepcopy([z,valueRef['stop']]))
valueTmp=splitSegment(z,valueTmp,valueRef['stop'])
actionsSegmentationBoundaryCreate.append(copy.deepcopy([z,valueRef['stop']]))
actionsIncrementalSegmentationBoundaryCreateTurn.append(copy.deepcopy([z,valueRef['stop']]))
valueTmp=splitSegment(z,valueTmp,valueRef['stop'])
if tolerance!=0:
valueTmp2=copy.deepcopy(valueTmp)
for u in valueTmp2:
......
Markdown is supported
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