コード例 #1
0
ファイル: analytics.py プロジェクト: calebshortt/shillbot
    def init_training(self, shill_filepath, notshill_filepath):

        s_content = []
        with open(shill_filepath, 'r') as fs:
            s_content = fs.readlines()
        shill_targets = [x.strip() for x in s_content]

        notshill_targets = []
        ns_content = []
        if notshill_filepath:
            with open(notshill_filepath, 'r') as fns:
                ns_content = fns.readlines()

            notshill_targets = [x.strip() for x in ns_content]

        corpus = []
        for shill in shill_targets:
            worker = BasicUserParseWorker(shill)
            result, root = worker.run(training_label=LABEL_SHILL, local=True)
            corpus += result

        for notshill in notshill_targets:
            worker = BasicUserParseWorker(notshill)
            result, root = worker.run(training_label=LABEL_NOTSHILL,
                                      local=True)
            corpus += result

        self.train_classifier({'data': corpus})
コード例 #2
0
from workers.basic_worker import BasicUserParseWorker

if __name__ == "__main__":
    worker = BasicUserParseWorker("https://www.reddit.com/user/Chrikelnel")
    worker.run()