File size: 713 Bytes
e7d695a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#  ------------------------------------------------------------------------------------------
#  Copyright (c) Microsoft Corporation. All rights reserved.
#  Licensed under the MIT License (MIT). See LICENSE in the repo root for license information.
#  ------------------------------------------------------------------------------------------
import sys
import io
import json


with open(sys.argv[1], 'r', encoding='utf8') as reader, \
	 open(sys.argv[2], 'w', encoding='utf8') as writer :
	for line in reader:
		items = line.strip().split('||')
		context = items[0]
		completion = items[1].strip('\n')
		x = {}
		x['context'] = context #+ '||'
		x['completion'] = completion
		writer.write(json.dumps(x)+'\n')