Пример #1
0
def norm_texts_history_compare(text_from, text_to):
    if text_to is None or text_from.id == text_to.id:
        return render_line_based(text_from)
    lines = _diff_line_based(text_to.text,
                             text_from.text,
                             replace_as_insert=True)
    return _line_table(lines)
Пример #2
0
def norm_texts_history_compare(text_from, text_to):
    if text_to is None or text_from.id == text_to.id:
        return render_line_based(text_from)
    lines = _diff_line_based(text_to.text,
                             text_from.text,
                             replace_as_insert=True)
    return _line_table(lines)
Пример #3
0
def norm_texts_history_compare(text_from, text_to):
    '''
    Note: Inverts from and to inside. Be prepared;)
    '''
    if text_to is None or text_from.id == text_to.id:
        return render_line_based(text_from)
    lines = _diff_line_based(text_to.text,
                             text_from.text,
                             replace_as_insert=True)
    return _line_table(lines)
Пример #4
0
def norm_texts_history_compare(text_from, text_to):
    '''
    Note: Inverts from and to inside. Be prepared;)
    '''
    if text_to is None or text_from.id == text_to.id:
        return render_line_based(text_from)
    lines = _diff_line_based(text_to.text,
                             text_from.text,
                             replace_as_insert=True)
    return _line_table(lines)
Пример #5
0
def norm_texts_table_compare(text_from, text_to):
    insertions = _diff_line_based(text_from.text,
                                  text_to.text,
                                  include_insertions=True,
                                  include_deletions=False,
                                  replace_as_insert=True,
                                  ratio_skip=0.8)

    deletions = _diff_line_based(text_from.text,
                                 text_to.text,
                                 include_insertions=False,
                                 include_deletions=True,
                                 replace_as_delete=True,
                                 ratio_skip=0.8)

    llines = []
    rlines = []
    for left, right in izip_longest(deletions, insertions, fillvalue=''):
        llines.append(left)
        rlines.append(right)
    return _line_table(llines), _line_table(rlines)
Пример #6
0
def norm_texts_table_compare(text_from, text_to):
    insertions = _diff_line_based(text_from.text,
                                  text_to.text,
                                  include_insertions=True,
                                  include_deletions=False,
                                  replace_as_insert=True,
                                  ratio_skip=0.8)

    deletions = _diff_line_based(text_from.text,
                                 text_to.text,
                                 include_insertions=False,
                                 include_deletions=True,
                                 replace_as_delete=True,
                                 ratio_skip=0.8)

    llines = []
    rlines = []
    for left, right in izip_longest(deletions, insertions, fillvalue=''):
        llines.append(left)
        rlines.append(right)
    return _line_table(llines), _line_table(rlines)