In [1]:
# Note: Python 2 Version
# author: Shaoying Tang
# Email: stang45@fordham.edu
import json
import numpy as np
import pandas as pd

In [9]:
with open('UKtag.json') as json_data:
    d = json.load(json_data)
len(d)


Out[9]:
18

In [43]:
sentence_id = []
cat = []
sentence = []
for s in d:
    sentence_id.append(s['sentence_id,'])
    cat.append(s['tag'])
    sentence.append(s['sentence'])

In [60]:
category = []
subcategory = []
for i in range(18):
    category.append(str(cat[i][0]['category']))
    subcategory.append(str(cat[i][0]['subcategory'][0]))

In [61]:
Reason= []
for i in range(18):
    Reason.append('Unknown For Now')

In [62]:
dd={'SentenceID':sentence_id,'Sentence':sentence,'Category':category,'Subcategory':subcategory,'Reason':Reason}
dframe = pd.DataFrame(dd)

In [63]:
dframe


Out[63]:
Category Reason Sentence SentenceID Subcategory
0 technical measures Unknown For Now Establish a new operational partnership with t... 0d6be37f8c standards
1 organization measures Unknown For Now ... balancing security with freedom and privac... 5b9988bc85 policy
2 technical measures Unknown For Now We will model best practice on cyber security ... 47818b8c05 standards
3 technical measures Unknown For Now We will work with industry to develop rigorous... 7352b33524 standards
4 technical measures Unknown For Now In particular we will raise the standard of cy... 1f69eae1de standards
5 technical measures Unknown For Now BIS will work with domestic, European and glob... e050e96516 standards
6 technical measures Unknown For Now So BIS will work to stimulate the development ... 2973af12ae standards
7 technical measures Unknown For Now BIS is also exploring ways in which industry-l... 1b4d15d03a standards
8 technical measures Unknown For Now BIS will work with users, industry and appropr... 1fc96236fb standards
9 technical measures Unknown For Now 4.51 As we have said, we plan to require highe... 397498e67e standards
10 technical measures Unknown For Now 4.52 We are also raising the standard of cyber... 54e6fa64db standards
11 technical measures Unknown For Now But the Government hopes these rising standard... 2afca8f86d standards
12 cooperation Unknown For Now Promote greater levels of international cooper... 01485d64cf international cooperation
13 technical measures Unknown For Now Working with domestic, European, global and co... 0261d67d51 standards
14 technical measures Unknown For Now Encourage industry-led standards and guidance ... 21c8c739f2 standards
15 organization measures Unknown For Now Work with allies to ensure implementation of N... 5ef3ef7649 policy
16 technical measures Unknown For Now Encourage international and regional organisat... d9519a2878 standards
17 organization measures Unknown For Now To view this licence, visit www.nationalarchiv... 155445a825 policy

In [68]:
dframe.to_excel('UKtag.xls')

In [ ]: