Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom paths for corpus data #467

Closed
vkosuri opened this issue Dec 5, 2016 · 8 comments
Closed

Custom paths for corpus data #467

vkosuri opened this issue Dec 5, 2016 · 8 comments
Assignees

Comments

@vkosuri
Copy link
Collaborator

vkosuri commented Dec 5, 2016

I think it would be good option to specify custom paths for corpus data, currently its system specified path only

class Corpus(object):

    def __init__(self):
        current_directory = os.path.dirname(__file__)
        self.data_directory = os.path.join(current_directory, 'data')
@vkosuri
Copy link
Collaborator Author

vkosuri commented Dec 10, 2016

@gunthercox Planning to write like this, any suggestions/comments?

@@ -9,6 +9,7 @@ class Trainer(object):
 
     def __init__(self, storage, **kwargs):
         self.storage = storage
+        self.corpus_path = None
         self.logger = logging.getLogger(__name__)
 
     def train(self, *args, **kwargs):
@@ -54,6 +55,10 @@ class Trainer(object):
 
         return result
 
+    def import_for_training(self, file_path):
+        self.corpus_path = file_path
+
+
     def export_for_training(self, file_path='./export.json'):
         """
         Create a file from the database that can be used to
@@ -100,7 +105,7 @@ class ChatterBotCorpusTrainer(Trainer):
         super(ChatterBotCorpusTrainer, self).__init__(storage, **kwargs)
         from .corpus import Corpus
 
-        self.corpus = Corpus()
+        self.corpus = Corpus(self.corpus_path)
 
     def train(self, *corpora):
         trainer = ListTrainer(self.storage)

@gunthercox
Copy link
Owner

@vkosuri Looks good to me 👍

@rajasimon
Copy link
Contributor

I like this to be integrated asap!

@vkosuri
Copy link
Collaborator Author

vkosuri commented Dec 21, 2016 via email

@rajasimon
Copy link
Contributor

rajasimon commented Dec 22, 2016

Can you make the pull request so I can check it and also does it support for adding my own custom adapters...?

i.e)

    'logic_adapters': [
        'chatterbot.logic.MathematicalEvaluation',
        'chatterbot.logic.BestMatch'
        'funstuff.logic.FunStuff'
    ],

@rajasimon
Copy link
Contributor

@rajasimon
Copy link
Contributor

@vkosuri Shall I have the patch now ?

@vkosuri
Copy link
Collaborator Author

vkosuri commented Dec 26, 2016 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants