def segs2flags(segStart, segEnd, segLabel, winSize):
 flags = []
 classNames = list(set(segLabel))
 curPos = (winSize / 2.0)
 while (curPos < segEnd[(-1)]):
  for i in range(len(segStart)):
   if ((curPos > segStart[i]) and (curPos <= segEnd[i])):
    break
  flags.append(classNames.index(segLabel[i]))
  curPos += winSize
 return (numpy.array(flags), classNames)

def segs2flags ( segStart , segEnd , segLabel , winSize ) : flags = [ ] classNames = list ( set ( segLabel ) ) curPos = ( winSize / 2.0 ) while ( curPos < segEnd [ ( - 1 ) ] ) : for i in range ( len ( segStart ) ) : if ( ( curPos > segStart [ i ] ) and ( curPos <= segEnd [ i ] ) ) : break flags . append ( classNames . index ( segLabel [ i ] ) ) curPos += winSize return ( numpy . array ( flags ) , classNames )
this function converts segment endpoints and respective segment labels to fix-sized class labels .