code/data_loader_Q5.py
def _pad(data, target):
        """
        Add padding to ensure word length is consistent
        """
        max_length = max(len(x) for x in target)
        padding = np.zeros((16, 8))
        data = [x + ([padding] * (max_length - len(x))) for x in data]
        target = [x + ([''] * (max_length - len(x))) for x in target]
        return np.array(data), np.array(target)

        Add padding to ensure word length is consistent
        
Add padding to ensure word length is consistent
Add padding to ensure word length is consistent
def _pad(data, target):
        max_length = max(len(x) for x in target)
        padding = np.zeros((16, 8))
        data = [x + ([padding] * (max_length - len(x))) for x in data]
        target = [x + ([''] * (max_length - len(x))) for x in target]
        return np.array(data), np.array(target)
def _pad ( data , target ) : max_length = max ( len ( x ) for x in target ) padding = np . zeros ( ( 16 , 8 ) ) data = [ x + ( [ padding ] * ( max_length - len ( x ) ) ) for x in data ] target = [ x + ( [ '' ] * ( max_length - len ( x ) ) ) for x in target ] return np . array ( data ) , np . array ( target )
Add padding to ensure word length is consistent
Add padding to ensure word length is consistent
"""
        Add padding to ensure word length is consistent
        """
data
target