Exemplo n.º 1
0
__author__ = 'daksh'
import time
from dishingOut.Database.database import MongoOperator as mongo
from dishingOut.NPChunking.NPChunker import NPChunker
import csv
import json

chunker = NPChunker()
chunker.train()


''' Get all test adjectives : Unfiltered. Around 1 lakh adjectives. Contains a lot of non adjectives'''
# database = mongo('DishingOut')
# database.setUpConnection()
# database.setUpCollection('reviews')

# restaurants = database.getAll()
restaurants = None
with open('../data/restaurants.json') as data_file:
	restaurants = json.load(data_file)
restaurants = restaurants[2000:]
start = time.time()
# for restaurant in restaurants:
#     for review in restaurant['userReviews']:
#         text = review['reviewText']
#         sentences = chunker.split(text)
#         for sent in sentences:
#             tree,terms = chunker.extractChunk(sent)
#             print(tree)

vocabulary = list()
Exemplo n.º 2
0
 def __init__(self):
     self.chunker = NPChunker()
     self.chunker.train()