(self, ex)
return len(ex.src)
Sort using length of source sentences.
Sort using length of source sentences.
Sort using length of source sentences .
def sort_key(self, ex):
        """ Sort using length of source sentences. """
        # Default to a balanced sort, prioritizing tgt len match.
        # TODO: make this configurable.
        if hasattr(ex, "tgt"):
            return len(ex.src), len(ex.tgt)
        return len(ex.src)
def sort_key ( self , ex ) : # Default to a balanced sort, prioritizing tgt len match. # TODO: make this configurable. if hasattr ( ex , "tgt" ) : return len ( ex . src ) , len ( ex . tgt ) return len ( ex . src )