In [1]:
import pymongo
from pymongo import MongoClient
client=MongoClient()
client = MongoClient('portland.cs.ou.edu', 23755)
db=client.lexisnexis
db.authenticate('username','password')
verbs=db.secondroles

In [35]:
sourcedic=db.sourcedictionaries
verbdic=db.verbdictionaries

In [7]:
noundictionary=[]
for dic in sourcedic.find():
    noundictionary.append({"noun":dic["word"],"firstrole":dic["firstRoleCode"],"secondrole":dic["secondRoleCode"],"countrycode":dic["countryCode"],"confidence_flag":dic["confidenceFlag"]})

In [37]:
verbdictionary=[]
for dic in verbdic.find():
    verbdictionary.append({"verb":dic["word"],"verbcode":dic["verbcode"],"confidenceFlag":dic["confidenceFlag"]})

In [12]:
len(noundictionary)


Out[12]:
3525

In [19]:
noundictionary[400]


Out[19]:
{'confidence_flag': False,
 'countrycode': 'SYR',
 'firstrole': 'GOV',
 'noun': 'السلطات السورية',
 'secondrole': ''}

In [33]:
thefile = open("noundic.txt", "w")
for item in noundictionary:
    thefile.write("%s\n" % item)
thefile.close()

In [38]:
thefile = open("verbdic.txt", "w")
for item in verbdictionary:
    thefile.write("%s\n" % item)
thefile.close()

In [ ]: