NLTK syntax problem

I did not understand what the below line of code is doing and why file path is appended to nltk data path
filePath = f"{getcwd()}/…/tmp2/"
nltk.data.path.append(filePath)

Hi, mohit.

getcwd() command returns the current working directory (where your notebook is running). For example if you type in a new cell getcwd() and run it, you will get something like ‘/home/jovyan/work/Week2’)

So the string format line f"{getcwd()}/…/tmp2/" will return you something like ‘/home/jovyan/work/Week2/…/tmp2/’ ( a path string)

The next line: nltk.data.path.append(filePath) appends the path to the nltk library.

The reason for this is that you would not have to download the corpora files everytime since they are pre-downloaded already it that path.