Exemple #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
Exemple #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
Exemple #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
    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
    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
Exemple #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'])
Exemple #7
0
 def test_ParserFailure(self):
     failparser = Parser('This test should return false', 'chicken')
     self.assertIsNotNone(failparser)
     self.assertEqual(failparser.doesMatchExist(), False)
Exemple #8
0
 def checkContext(self, contextRegex):
     contextChecker = Parser(self.stringToScan.lower(), contextRegex)
     return contextChecker.doesMatchExist()
Exemple #9
0
 def checkContext(self, contextCriteria):
     contextChecker = Parser(self.stringToScan.lower(), contextCriteria)
     return contextChecker.doesMatchExist()
Exemple #10
0
 def checkGraduate(self):
     if not self.checkContext('graduate\sfrom|graduates'):
         findGraduate = Parser(self.stringToScan.lower(), '^graduate|\sgraduate')
         if findGraduate.doesMatchExist():
             return ['graduate']
Exemple #11
0
 def checkGraduate(self):
     if not self.checkContext('graduate\sfrom|graduates'):
         findGraduate = Parser(self.stringToScan.lower(),
                               '^graduate|\sgraduate')
         if findGraduate.doesMatchExist():
             return ['graduate']
Exemple #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()