Esempio n. 1
0
 def checkYear(self):
     findYear = Parser(self.stringToScan.lower(), '1st|2nd|3rd|4th|5th|6th')
     if findYear.doesMatchExist():
         years = []
         for i in findYear.getResult():
             years.append('%s Year' % i)
         return years
Esempio n. 2
0
 def checkYear(self):
     findYear = Parser(self.stringToScan.lower(), '1st|2nd|3rd|4th|5th|6th')
     if findYear.doesMatchExist():
         years = []
         for i in findYear.getResult():
             years.append('%s Year' % i)
         return years
Esempio n. 3
0
    def getMajors(self):
        if self.checkContext(
                'enrolled in|majoring in|program|major|concentration|pursuing|student|study\sof') and self.doesMatchExist():
            for i in self.getResult():
                self.resultList.append(i)

        if self.checkContext('of\sscience|of\sarts|of\smedicine') and self.doesMatchExist():
            if 'science' in self.resultList:
                self.resultList.remove('science')
            if 'arts' in self.resultList:
                self.resultList.remove('arts')
            if 'medicine' in self.resultList:
                self.resultList.remove('medicine')

        if self.checkContext('engineering'):
            tokenizeEngineeringString = re.findall(r"[\w']+", self.stringToScan)
            for i in range(len(tokenizeEngineeringString)):
                if tokenizeEngineeringString[i] == 'engineering':
                    engineeringContextSlice = tokenizeEngineeringString[i - 5:i]
                    concatenateEngineeringWithWord = []
                    for i in engineeringContextSlice:
                        concatenateEngineeringWithWord.append('%s engineering' % i)

                    for i in concatenateEngineeringWithWord:
                        checkEngineeringMajors = Parser(i, self.majorsRegex)
                        if checkEngineeringMajors.doesMatchExist():
                            for i in checkEngineeringMajors.getResult():
                                self.resultList.append(i)
                                if 'engineering' in self.resultList:
                                    self.resultList.remove('engineering')

        self.resultList = list(set(self.resultList))

        self.major = ', '.join(self.resultList)
        return self.major
Esempio n. 4
0
    def getEmploymentStatus(self):
        if self.checkContext('work|employ|job'):
            if self.doesMatchExist():
                for i in self.getResult():
                    self.resultList.append(i)
            elif self.checkContext('hour'):
                findHours = Parser(self.stringToScan, '\d{1,2}')
                if findHours.doesMatchExist():
                    for i in findHours.getResult():
                        self.resultList.append('%s Hours' % i)

        self.resultList = list(set(self.resultList))
        return self.resultList
Esempio n. 5
0
    def getEmploymentStatus(self):
        if self.checkContext('work|employ|job'):
            if self.doesMatchExist():
                for i in self.getResult():
                    self.resultList.append(i)
            elif self.checkContext('hour'):
                findHours = Parser(self.stringToScan, '\d{1,2}')
                if findHours.doesMatchExist():
                    for i in findHours.getResult():
                        self.resultList.append('%s Hours' % i)

        self.resultList = list(set(self.resultList))
        return self.resultList
Esempio n. 6
0
 def test_Parser(self):
     testparser = Parser('This is a test', 'test')
     self.assertIsNotNone(testparser)
     self.assertEqual(testparser.doesMatchExist(), True)
     self.assertEqual(testparser.getResult(), ['test'])
Esempio n. 7
0
 def test_ParserFailure(self):
     failparser = Parser('This test should return false', 'chicken')
     self.assertIsNotNone(failparser)
     self.assertEqual(failparser.doesMatchExist(), False)
Esempio n. 8
0
 def checkContext(self, contextRegex):
     contextChecker = Parser(self.stringToScan.lower(), contextRegex)
     return contextChecker.doesMatchExist()
Esempio n. 9
0
 def checkContext(self, contextCriteria):
     contextChecker = Parser(self.stringToScan.lower(), contextCriteria)
     return contextChecker.doesMatchExist()
Esempio n. 10
0
 def checkGraduate(self):
     if not self.checkContext('graduate\sfrom|graduates'):
         findGraduate = Parser(self.stringToScan.lower(), '^graduate|\sgraduate')
         if findGraduate.doesMatchExist():
             return ['graduate']
Esempio n. 11
0
 def checkGraduate(self):
     if not self.checkContext('graduate\sfrom|graduates'):
         findGraduate = Parser(self.stringToScan.lower(),
                               '^graduate|\sgraduate')
         if findGraduate.doesMatchExist():
             return ['graduate']
Esempio n. 12
0
 def checkDueDateContext(self):
     contextRegex = 'due\sdate|application\swindow|deadline|dead\sline|close\sdate|close|closing\sdate'
     contextChecker = Parser(self.stringToScan.lower(), contextRegex)
     return contextChecker.doesMatchExist()