How can I replace some words in my text file by keywords provided in another file using python? I'm new to Python.
I have two files. one file contains text, the second contain keywords.Here is a sample of the keywords file : 

Parental authority

Rights and Responsibilities

Health and Safety


I want my code to parse my text, and whenever he finds a derivation of one of the keywords, he would replace them with the keyword as it is in my file.

Exemple : if "healthy and safe" is found in the text, he would replace it with "Health and Safety" mentioned in the keywords file.

I already have a function "Vocabulary" that does the lemmatization: 
print(j --> Vocabulary[j]) would display a word and its derivations. Exemple : 

Safety --> Safely, Safe

Here is my code : 

import pandas as pd
import numpy as np
import spacy
from itertools import product
import re

text = pd.read_csv(name_file, sep=';', header=None, index_col=0)
text.shape
for i in text.index:
  document = i.lower
    for j in vocabulary:
       for t in vocabulary[j]:
        document.replace(t,j)


As a result, I'm having the following error :

AttributeError: 'builtin_function_or_method' object has no attribute 'replace'
Try i.lower(). 

It might be that document is not a string, but a function at the time in which you call document.replace(t, j)