Search code examples
pythonjsondjangocorpuschatterbot

How to specify custom corpus path in Django for Chatterbot?


It seems one can use custom corpus json files by specify a path to the location. However, I'm confused by how that is done. The example provided by chatterbot isn't very clear.

http://chatterbot.readthedocs.io/en/stable/training.html

they do.

"./data/my_corpus/"

does the ./ mean root with a folder named data inside? If so what is root? My django app?

And in the other line they directly refrence the .json file? They also seem to do .corpus.json? Is that the correct file name scheme? Do I need both lines? Its very confusing not a lot of clarity.

Is there a clear example of how to do this?


Solution

  • Training data ( training_data ) accepts list of files. You can mention that file like this... <your_app or directory>/folders...

    backend
    |___ corbus/data/introduction.py
        |___ __init__.py
    
    project
    |___ settings.py
    

    then in your settings you can mention the training data file by

    'training_data': [
        'chatterbot.corpus.english',
        'backend/corpus/data/introduction/'
    ]