How to do json format using nltk

2019-09-10 06:20发布

How to do json format using nltk. Example:

tagged_sent = [('Rami', 'PERSON'), ('Eid', 'PERSON'), ('is', 'O'), ('studying', 'O'), ('at', 'O'), ('Stony', 'ORGANIZATION'), ('Brook', 'ORGANIZATION'), ('University', 'ORGANIZATION'), ('in', 'O'), ('NY', 'LOCATION')]

I want output like json format:

data = {
        'Rami Eid':{'job': 'engineer', 'location':'NY'},
        'GuruRaj Bagali':{'job': 'professor', 'location':
 'NY'}
       }

0条回答
登录 后发表回答