def apply(self, inputDf):

    def removeUrl(content):
        return re.sub('https?://\\S+', '', content)

    def removeMultWhitespace(content):
        return re.sub(' +', ' ', content)
    if self.removeURLs:
        inputDf['Content'] = inputDf.apply((lambda row: removeUrl(row['Content'])), axis=1)
    if self.removeMultWhitespace:
        inputDf['Content'] = inputDf.apply((lambda row: removeMultWhitespace(row['Content'])), axis=1)
    if self.lowercasing:
        inputDf['Content'] = inputDf.apply((lambda row: row['Content'].lower()), axis=1)
    if (inputDf['Content'].isnull().values.any() or inputDf['Datetime'].isnull().values.any() or inputDf['From'].isnull().values.any() or inputDf['To'].isnull().values.any()):
        raise AttributeError('Content, Datetime, From and To field cannot be empty. Please check your input dataset.')

    def reformatDate(datestring, dateformat):
        try:
            newDate = dateutil.parser.parse(datestring, dayfirst=True)
            return newDate.strftime(dateformat)
        except ValueError as e:
            raise ValueError('Make sure that all datetime columns are well-formatted and that they contain dates that are within the possible bounds.') from e
    inputDf['Datetime'] = inputDf.apply((lambda row: reformatDate(row['Datetime'], self.dateFormat)), axis=1)

    def stripEndClauses(content, clauses):
        clauseIndex = 0
        index = 0
        for item in clauses:
            index = content.lower().find(item.lower())
            if ((index > (- 1)) and ((index < clauseIndex) or (clauseIndex == 0))):
                clauseIndex = index
        if (clauseIndex > 0):
            return content[:clauseIndex]
        else:
            return content

    def stripStartClauses(content, clauses):
        clauseIndex = 0
        index = 0
        for item in clauses:
            index = content.lower().find(item.lower())
            if ((index > (- 1)) and ((index > clauseIndex) or (clauseIndex == 0))):
                clauseIndex = index
        if (clauseIndex > 0):
            return content[clauseIndex:]
        else:
            return content
    startClausesList = []
    endGreetingsList = ['Yours sincerely', 'Sincerely', 'Sincerely yours', 'Take care', 'Regards', 'Warm regards', 'Best regards', 'Kind regards', 'Warmest regards', 'Yours truly', 'Yours,', 'Warmly,', 'Warm wishes', 'Best,', 'Best Wishes', 'Thanks in advance', 'Thank you in advance', 'Thanks in advance']
    confList = ['The information contained in this communication', 'The content of this email is confidential', 'The content of this e-mail', 'This email and attachments (if any) is intended', 'This email is intended solely', 'This e-mail is intended solely']
    endClausesList = (endGreetingsList + confList)
    inputDf['Content'] = inputDf.apply((lambda row: stripEndClauses(row['Content'], endClausesList)), axis=1)
    inputDf['Content'] = inputDf.apply((lambda row: stripStartClauses(row['Content'], startClausesList)), axis=1)
    inputDf['Content'] = inputDf.apply((lambda row: re.sub('\\n+', '\n', row['Content'])), axis=1)
    inputDf['Content'] = inputDf.apply((lambda row: re.sub('\\n', ' ', row['Content'])), axis=1)
def apply(self, inputDf):

    def removeUrl(content):
        return re.sub('https?://\\S+', , content)

    def removeMultWhitespace(content):
        return re.sub(' +', ' ', content)
    if self.removeURLs:
        inputDf['Content'] = inputDf.apply((lambda row: removeUrl(row['Content'])), axis=1)
    if self.removeMultWhitespace:
        inputDf['Content'] = inputDf.apply((lambda row: removeMultWhitespace(row['Content'])), axis=1)
    if self.lowercasing:
        inputDf['Content'] = inputDf.apply((lambda row: row['Content'].lower()), axis=1)
    if (inputDf['Content'].isnull().values.any() or inputDf['Datetime'].isnull().values.any() or inputDf['From'].isnull().values.any() or inputDf['To'].isnull().values.any()):
        raise AttributeError('Content, Datetime, From and To field cannot be empty. Please check your input dataset.')

    def reformatDate(datestring, dateformat):
        try:
            newDate = dateutil.parser.parse(datestring, dayfirst=True)
            return newDate.strftime(dateformat)
        except ValueError as e:
            raise ValueError('Make sure that all datetime columns are well-formatted and that they contain dates that are within the possible bounds.') from e
    inputDf['Datetime'] = inputDf.apply((lambda row: reformatDate(row['Datetime'], self.dateFormat)), axis=1)

    def stripEndClauses(content, clauses):
        clauseIndex = 0
        index = 0
        for item in clauses:
            index = content.lower().find(item.lower())
            if ((index > (- 1)) and ((index < clauseIndex) or (clauseIndex == 0))):
                clauseIndex = index
        if (clauseIndex > 0):
            return content[:clauseIndex]
        else:
            return content

    def stripStartClauses(content, clauses):
        clauseIndex = 0
        index = 0
        for item in clauses:
            index = content.lower().find(item.lower())
            if ((index > (- 1)) and ((index > clauseIndex) or (clauseIndex == 0))):
                clauseIndex = index
        if (clauseIndex > 0):
            return content[clauseIndex:]
        else:
            return content
    startClausesList = []
    endGreetingsList = ['Yours sincerely', 'Sincerely', 'Sincerely yours', 'Take care', 'Regards', 'Warm regards', 'Best regards', 'Kind regards', 'Warmest regards', 'Yours truly', 'Yours,', 'Warmly,', 'Warm wishes', 'Best,', 'Best Wishes', 'Thanks in advance', 'Thank you in advance', 'Thanks in advance']
    confList = ['The information contained in this communication', 'The content of this email is confidential', 'The content of this e-mail', 'This email and attachments (if any) is intended', 'This email is intended solely', 'This e-mail is intended solely']
    endClausesList = (endGreetingsList + confList)
    inputDf['Content'] = inputDf.apply((lambda row: stripEndClauses(row['Content'], endClausesList)), axis=1)
    inputDf['Content'] = inputDf.apply((lambda row: stripStartClauses(row['Content'], startClausesList)), axis=1)
    inputDf['Content'] = inputDf.apply((lambda row: re.sub('\\n+', '\n', row['Content'])), axis=1)
    inputDf['Content'] = inputDf.apply((lambda row: re.sub('\\n', ' ', row['Content'])), axis=1)