Esempio n. 1
0
    def __init__(self):
        LOG_FILE = "logs/queryProcessor.log"
        self.__logger = logging.getLogger("queryProcessor")
        file_handler = logging.FileHandler(LOG_FILE)
        self.__logger.addHandler(file_handler)

        self.__config = ConfigurationParser()
        self.__database = DatabaseFactory().getDatabase(
            self.__config.getEngineConfig("SmartPDFAssistant")['database'])
Esempio n. 2
0
    def __init__(self):

        # This makes class singelton
        __metaclass__ = Singleton

        # Instating Logger
        LOG_FILE = "logs/database.log"
        self.__logger = logging.getLogger("mongo")
        file_handler = logging.FileHandler(LOG_FILE)
        self.__logger.addHandler(file_handler)

        self.__config = ConfigurationParser()

        # Database server configurations
        self.__port = int(self.__config.getDatabaseConfig()['port'])
        self.__host = self.__config.getDatabaseConfig()['host']
        self.__maxDelay = 10

        self.__connect()
Esempio n. 3
0
    def __addToDatabase(self, chunks):
        self.__config = ConfigurationParser()
        self.__database = DatabaseFactory().getDatabase(self.__config.getEngineConfig("SmartPDFAssistant")['database'])

        for chunk in chunks:
            self.__database.insertInto("PDFAssistant", "ProcessedPDF",{'Date': datetime.now().strftime("%d/%m/%Y %H:%M:%S"), 'Title': chunk[0],'Text': chunk[1], 'Keywords': chunk[2]})
Esempio n. 4
0
import os
import logging
from datetime import datetime
from flask import Flask,request, render_template, url_for, redirect, jsonify

from Engines.QueryProcessor import QueryProcessor
from ConfigParser.ConfigParser import ConfigurationParser
from Factory.DatabaseFactory import DatabaseFactory
from Processor.WMD import WMD

app = Flask(__name__, static_url_path='',
            static_folder='templates',
            template_folder='templates')
config = ConfigurationParser()
db = DatabaseFactory().getDatabase(config.getEngineConfig("SmartPDFAssistant")['database'])
portNumber = int(config.getServerConfig()['port'])
queryProcessor = QueryProcessor()
wmd = WMD()

# Loading Glove vectors
wmdmodel = wmd.load()

LOG_FILE = "logs/server.log"
logger = logging.getLogger("server")
file_handler = logging.FileHandler(LOG_FILE)
logger.addHandler(file_handler)
logger.info("[{}] : Successfully hosted server at {}".format(datetime.now().strftime("%d/%m/%Y %H:%M:%S"), str(portNumber)))


# Route for home page
@app.route('/')