示例#1
0
 def createNewJob(self, contentName, contentID, keyword, content):
     con = None
     try:
         con = psycopg2.connect(database='d1s3idai1l2u3d', user='******', password='******', host='ec2-54-197-241-24.compute-1.amazonaws.com', port='5432', sslmode='require')
         cur = con.cursor()
     except psycopg2.DatabaseError as e:
         print ('Error %s' % e)
         sys.exit(1)
     finally:
         if con:
             cur.execute("SELECT * FROM resume");
             rows = cur.fetchall()
             numRows = (len(rows))
             newJob = JobDescNode(contentID, keyword, content)
             if (numRows == 0):
                 ResumeProcessor.construct(newJob)
                 toPrint = encodeClassToJson(newJob)
                 cur.execute("INSERT INTO job VALUES (%s,%s,%s,%s)",(toPrint,'f', contentID ,contentName))
                 con.commit()
             else:
                 ResumeProcessor.construct(newJob)
                 toPrint = encodeClassToJson(newJob)
                 cur.execute("INSERT INTO job VALUES (%s,%s,%s,%s)",(toPrint,'f', contentID ,contentName))
                 con.commit()
                 f = Facade()
                 matcher = Matcher(f)
                 scorer = Scorer(f)
                 matcher.matchAll(2)
                 scorer.calculateScore()
             con.close()
示例#2
0
    def createNewResume(self, name, hpNumber, email, contentName, content):
        con = None
        try:
            con = psycopg2.connect(
                database='d1s3idai1l2u3d',
                user='******',
                password='******',
                host='ec2-54-197-241-24.compute-1.amazonaws.com',
                port='5432',
                sslmode='require')
            cur = con.cursor()
        except psycopg2.DatabaseError as e:
            print('Error %s' % e)
            sys.exit(1)
        finally:
            if con:
                cur.execute("SELECT * FROM job")
                rows = cur.fetchall()
                numRows = (len(rows))
                newResume = ResumeNode(name, hpNumber, email, contentName,
                                       content)

                if (numRows == 0):
                    ResumeProcessor.construct(newResume)
                    toPrint = encodeClassToJson(newResume)
                    cur.execute(
                        "INSERT INTO resume VALUES (%s,%s,%s,%s,%s,%s)",
                        (toPrint, 'f', contentName, name, hpNumber, email))
                    con.commit()
                else:
                    ResumeProcessor.construct(newResume)
                    toPrint = encodeClassToJson(newResume)
                    cur.execute(
                        "INSERT INTO resume VALUES (%s,%s,%s,%s,%s,%s)",
                        (toPrint, 'f', contentName, name, hpNumber, email))
                    con.commit()
                    f = Facade()
                    matcher = Matcher(f)
                    scorer = Scorer(f)
                    matcher.matchAll(1)
                    scorer.calculateScore()
                con.close()
示例#3
0
 numRows = (len(rows))
 newJob = JobDescNode(contentID, contentFile, keyword)
 if (numRows == 0):
     ResumeProcessor.construct(newJob)
     toPrint = encodeClassToJson(newJob)
     cur.execute("INSERT INTO job VALUES (%s,%s,%s,%s)",(toPrint,'f', contentID ,contentName))
     con.commit()
     print('just store job')
 else:
     ResumeProcessor.construct(newJob)
     toPrint = encodeClassToJson(newJob)
     cur.execute("INSERT INTO job VALUES (%s,%s,%s,%s)",(toPrint,'f', contentID ,contentName))
     con.commit()
     f = Facade()
     matcher = Matcher(f)
     scorer = Scorer(f)
     cur.execute("SELECT isonce_resume FROM once")
     rows = cur.fetchall()
     for row in rows:
         if(row[0] is True):
             cur.execute("UPDATE once SET isonce_resume=%s",('f',))
             con.commit()
             print('calling match 0 --1 ')
             matcher.matchAll(0)
             scorer.calculateScore()
             print('calling match 0 --2')
         else:
             matcher.matchAll(2)
             scorer.calculateScore()
             print('fdsfds')
     con.close()
示例#4
0
 def getResults(self):
     scorer = Scorer(self.facade)
     scorer.calculateScore()