utils.py 312 Bytes
Newer Older
lintangsutawika's avatar
lintangsutawika committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14

def doc_to_text(doc):

    inputs = ' '.join(doc['code_tokens']).replace('\n',' ')
    inputs = ' '.join(inputs.strip().split())

    return inputs

def doc_to_target(doc):

    targets = ' '.join(doc['docstring_tokens']).replace('\n','')
    targets = ' '.join(targets.strip().split())     

    return targets