Jann/utils.py
def extract_pairs(conversations):
    """Extract pairs from the Cornell Movie Dialog Conversations."""
    collected_pairs = []
    for conversation in conversations:
        # if convo is ABC, pairs are AB and BC
        for i in range(len(conversation["lines"]) - 1):
            first_line = conversation["lines"][i]["text"].strip()
            second_line = conversation["lines"][i+1]["text"].strip()
            if first_line and second_line:
                collected_pairs.append([first_line, second_line])
    return collected_pairs
Extract pairs from the Cornell Movie Dialog Conversations.
Extract pairs from the Cornell Movie Dialog Conversations.
Extract pairs from the Cornell Movie Dialog Conversations .
def extract_pairs(conversations):
    collected_pairs = []
    for conversation in conversations:
        for i in range(len(conversation["lines"]) - 1):
            first_line = conversation["lines"][i]["text"].strip()
            second_line = conversation["lines"][i+1]["text"].strip()
            if first_line and second_line:
                collected_pairs.append([first_line, second_line])
    return collected_pairs
def extract_pairs ( conversations ) : collected_pairs = [ ] for conversation in conversations : for i in range ( len ( conversation [ "lines" ] ) - 1 ) : first_line = conversation [ "lines" ] [ i ] [ "text" ] . strip ( ) second_line = conversation [ "lines" ] [ i + 1 ] [ "text" ] . strip ( ) if first_line and second_line : collected_pairs . append ( [ first_line , second_line ] ) return collected_pairs
Extract pairs from the Cornell Movie Dialog Conversations.
Extract pairs from the Cornell Movie Dialog Conversations .
"""Extract pairs from the Cornell Movie Dialog Conversations.""" # if convo is ABC, pairs are AB and BC
conversations