Skip to content

ValueError: max() iterable argument is empty - aligner_gui.py #1

Description

@Gl8ching

First, thanks for the excellent project.

I encountered a bug when using the aligner_gui.py to align one source language against multiple target languages.

STATUS: Aligning with Target 1...
STATUS: Aligning with Target 2...

during "Building multilingual alignments..." the script encounters the following error:

ValueError: max() iterable argument is empty

in aligner_gui.py changing:

    for src_indices, tgt_indices, _ in lang_alignments:
        if not src_indices:
            continue
        tgt_indices = _as_list(tgt_indices)
        src_indices = _as_list(src_indices)
        min_src = min(src_indices)

To:

    for src_indices, tgt_indices, _ in lang_alignments:
        tgt_indices = _as_list(tgt_indices)
        src_indices = _as_list(src_indices)
        if not src_indices or not tgt_indices:
            continue
        min_src = min(src_indices)

Fixed the error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions