(fileName, lines,
                      fields=["character1ID", "character2ID", "movieID", "utteranceIDs"],
                      delimiter=" +++$+++ ")
return conversations
Args:
        fileName (str): file to load
        field (set<str>): fields to extract
    Return:
        dict<dict<str>>: the extracted fields for each line
Args:
        fileName (str): file to load
        field (set<str>): fields to extract
    Return:
        dict<dict<str>>: the extracted fields for each line
Args : fileName ( str ) : file to load field ( set<str > ) : fields to extract Return : dict<dict<str >> : the extracted fields for each line
def loadConversations(fileName, lines,
                      fields=["character1ID", "character2ID", "movieID", "utteranceIDs"],
                      delimiter=" +++$+++ "):
    """
    Args:
        fileName (str): file to load
        field (set<str>): fields to extract
    Return:
        dict<dict<str>>: the extracted fields for each line
    """
    conversations = []

    with open(fileName, 'r', encoding='iso-8859-1') as f:
        for line in f:
            values = line.split(delimiter)

            # Extract fields
            convObj = {}
            for i, field in enumerate(fields):
                convObj[field] = values[i]

            # Convert string to list (convObj["utteranceIDs"] == "['L598485', 'L598486', ...]")
            lineIds = eval(convObj["utteranceIDs"])

            # Reassemble lines
            convObj["lines"] = []
            for lineId in lineIds:
                convObj["lines"].append(lines[lineId])

            conversations.append(convObj)

    return conversations
def loadConversations ( fileName , lines , fields = [ "character1ID" , "character2ID" , "movieID" , "utteranceIDs" ] , delimiter = " +++$+++ " ) : conversations = [ ] with open ( fileName , 'r' , encoding = 'iso-8859-1' ) as f : for line in f : values = line . split ( delimiter ) # Extract fields convObj = { } for i , field in enumerate ( fields ) : convObj [ field ] = values [ i ] # Convert string to list (convObj["utteranceIDs"] == "['L598485', 'L598486', ...]") lineIds = eval ( convObj [ "utteranceIDs" ] ) # Reassemble lines convObj [ "lines" ] = [ ] for lineId in lineIds : convObj [ "lines" ] . append ( lines [ lineId ] ) conversations . append ( convObj ) return conversations