Jann/utils.py
def load_conversations(fname, lines, fields):
    """Load Cornell Movie Dialog Conversations."""
    convos = []
    with open(fname, 'r', encoding='iso-8859-1') as f:
        for line in f:
            values = line.split(" +++$+++ ")
            conv_obj = {}
            for i, field in enumerate(fields):
                conv_obj[field] = values[i]
            # Convert string to list
            line_ids = eval(conv_obj["utteranceIDs"])
            conv_obj["lines"] = []
            for line_id in line_ids:
                conv_obj["lines"].append(lines[line_id])
            convos.append(conv_obj)
    return convos
Load Cornell Movie Dialog Conversations.
Load Cornell Movie Dialog Conversations.
Load Cornell Movie Dialog Conversations .
def load_conversations(fname, lines, fields):
    convos = []
    with open(fname, 'r', encoding='iso-8859-1') as f:
        for line in f:
            values = line.split(" +++$+++ ")
            conv_obj = {}
            for i, field in enumerate(fields):
                conv_obj[field] = values[i]
            line_ids = eval(conv_obj["utteranceIDs"])
            conv_obj["lines"] = []
            for line_id in line_ids:
                conv_obj["lines"].append(lines[line_id])
            convos.append(conv_obj)
    return convos
def load_conversations ( fname , lines , fields ) : convos = [ ] with open ( fname , 'r' , encoding = 'iso-8859-1' ) as f : for line in f : values = line . split ( " +++$+++ " ) conv_obj = { } for i , field in enumerate ( fields ) : conv_obj [ field ] = values [ i ] line_ids = eval ( conv_obj [ "utteranceIDs" ] ) conv_obj [ "lines" ] = [ ] for line_id in line_ids : conv_obj [ "lines" ] . append ( lines [ line_id ] ) convos . append ( conv_obj ) return convos
Load Cornell Movie Dialog Conversations.
Load Cornell Movie Dialog Conversations .
"""Load Cornell Movie Dialog Conversations.""" # Convert string to list
fname
lines
fields