def groupIntoChoices(splitsOnWord, wordWidth: int, origin: OneOfTransaction):
    """
    :param splitsOnWord: list of lists of parts (fields splited on word
        boundaries)
    :return: generators of ChoicesOfFrameParts for each word
        which are not crossing word boundaries
    """
    def cmpWordIndex(a, b):
        return a.startOfPart // wordWidth < b.startOfPart // wordWidth

    actual = None
    itCnt = len(splitsOnWord)
    for i, item in iterSort(splitsOnWord, cmpWordIndex):
        _actualW = item.startOfPart // wordWidth
        if actual is None:
            # first pass
            actual = ChoicesOfFrameParts(item.startOfPart, origin)
            actual.extend(
                ChoiceOfFrameParts(actual,
                                   origin.possibleTransactions[_i])
                for _i in range(itCnt))
            actualW = _actualW
        elif _actualW > actualW:
            actual.resolveEnd()
            yield actual
            actual = ChoicesOfFrameParts(item.startOfPart, origin)
            actual.extend(
                ChoiceOfFrameParts(actual,
                                   origin.possibleTransactions[_i])
                for _i in range(itCnt))
            actualW = _actualW
        actual[i].append(item)

    if actual is not None:
        actual.setIsLast(True)
        actual.resolveEnd()
        yield actual
def groupIntoChoices(splitsOnWord, wordWidth: int, origin: OneOfTransaction):
    """
    :param splitsOnWord: list of lists of parts (fields splited on word
        boundaries)
    :return: generators of ChoicesOfFrameParts for each word
        which are not crossing word boundaries
    """
    def cmpWordIndex(a, b):
        return a.startOfPart // wordWidth < b.startOfPart // wordWidth

    actual = None
    itCnt = len(splitsOnWord)
    for i, item in iterSort(splitsOnWord, cmpWordIndex):
        _actualW = item.startOfPart // wordWidth
        if actual is None:
            # first pass
            actual = ChoicesOfFrameParts(item.startOfPart, origin)
            actual.extend(
                ChoiceOfFrameParts(actual,
                                   origin.possibleTransactions[_i])
                for _i in range(itCnt))
            actualW = _actualW
        elif _actualW > actualW:
            actual.resolveEnd()
            yield actual
            actual = ChoicesOfFrameParts(item.startOfPart, origin)
            actual.extend(
                ChoiceOfFrameParts(actual,
                                   origin.possibleTransactions[_i])
                for _i in range(itCnt))
            actualW = _actualW
        actual[i].append(item)

    if actual is not None:
        actual.setIsLast(True)
        actual.resolveEnd()
        yield actual
def groupIntoChoices ( splitsOnWord , wordWidth : int , origin : OneOfTransaction ) : def cmpWordIndex ( a , b ) : return a . startOfPart // wordWidth < b . startOfPart // wordWidth actual = None itCnt = len ( splitsOnWord ) for i , item in iterSort ( splitsOnWord , cmpWordIndex ) : _actualW = item . startOfPart // wordWidth if actual is None : # first pass actual = ChoicesOfFrameParts ( item . startOfPart , origin ) actual . extend ( ChoiceOfFrameParts ( actual , origin . possibleTransactions [ _i ] ) for _i in range ( itCnt ) ) actualW = _actualW elif _actualW > actualW : actual . resolveEnd ( ) yield actual actual = ChoicesOfFrameParts ( item . startOfPart , origin ) actual . extend ( ChoiceOfFrameParts ( actual , origin . possibleTransactions [ _i ] ) for _i in range ( itCnt ) ) actualW = _actualW actual [ i ] . append ( item ) if actual is not None : actual . setIsLast ( True ) actual . resolveEnd ( ) yield actual
:param splitsOnWord: list of lists of parts (fields splited on word
        boundaries)
    :return: generators of ChoicesOfFrameParts for each word
        which are not crossing word boundaries
: param splitsOnWord : list of lists of parts ( fields splited on word boundaries ) : return : generators of ChoicesOfFrameParts for each word which are not crossing word boundaries