(index_to_token, gt, pr)
Print out some example strings of input - output pairs.
Print out some example strings of input - output pairs.
Print out some example strings of input - output pairs .
def display_text(index_to_token, gt, pr):
    """
    Print out some example strings of input - output pairs.
    """
    index_to_token[0] = '|'  # remove actual line breaks

    display_len = 3 * time_steps

    # sample 3 sentences and their start and end time steps
    (s1_s, s1_e) = (0, time_steps)
    (s2_s, s2_e) = (time_steps, 2*time_steps)
    (s3_s, s3_e) = (2*time_steps, 3*time_steps)

    gt_string = "".join([index_to_token[gt[k]] for k in range(display_len)])
    pr_string = "".join([index_to_token[pr[k]] for k in range(display_len)])

    match = np.where([gt_string[k] == pr_string[k] for k in range(display_len)])

    di_string = "".join([gt_string[k] if k in match[0] else '.'
                        for k in range(display_len)])

    neon_logger.display('GT:   [' + gt_string[s1_s:s1_e] + '] '
                        '[' + gt_string[s2_s:s2_e] + '] '
                        '[' + gt_string[s3_s:s3_e] + '] ')

    neon_logger.display('Pred: [' + pr_string[s1_s:s1_e] + '] '
                        '[' + pr_string[s2_s:s2_e] + '] '
                        '[' + pr_string[s3_s:s3_e] + '] ')

    neon_logger.display('Difference indicated by .')
    neon_logger.display('Diff: [' + di_string[s1_s:s1_e] + '] '
                        '[' + di_string[s2_s:s2_e] + '] '
                        '[' + di_string[s3_s:s3_e] + '] ')
def display_text ( index_to_token , gt , pr ) : index_to_token [ 0 ] = '|' # remove actual line breaks display_len = 3 * time_steps # sample 3 sentences and their start and end time steps ( s1_s , s1_e ) = ( 0 , time_steps ) ( s2_s , s2_e ) = ( time_steps , 2 * time_steps ) ( s3_s , s3_e ) = ( 2 * time_steps , 3 * time_steps ) gt_string = "" . join ( [ index_to_token [ gt [ k ] ] for k in range ( display_len ) ] ) pr_string = "" . join ( [ index_to_token [ pr [ k ] ] for k in range ( display_len ) ] ) match = np . where ( [ gt_string [ k ] == pr_string [ k ] for k in range ( display_len ) ] ) di_string = "" . join ( [ gt_string [ k ] if k in match [ 0 ] else '.' for k in range ( display_len ) ] ) neon_logger . display ( 'GT:   [' + gt_string [ s1_s : s1_e ] + '] ' '[' + gt_string [ s2_s : s2_e ] + '] ' '[' + gt_string [ s3_s : s3_e ] + '] ' ) neon_logger . display ( 'Pred: [' + pr_string [ s1_s : s1_e ] + '] ' '[' + pr_string [ s2_s : s2_e ] + '] ' '[' + pr_string [ s3_s : s3_e ] + '] ' ) neon_logger . display ( 'Difference indicated by .' ) neon_logger . display ( 'Diff: [' + di_string [ s1_s : s1_e ] + '] ' '[' + di_string [ s2_s : s2_e ] + '] ' '[' + di_string [ s3_s : s3_e ] + '] ' )