Exemplo n.º 1
0
    def addTrainingScore(self, essay, scoreName='domain1_score'):
        if essay.essay_id not in self.trainingAnswerMap:
            raise LookupError("Essay hasn't been added to training answers yet.")
            return

        data = { "training_answer": lsrh.getTrainingAnswerURL(self.trainingAnswerMap[essay.essay_id]),
                 "label": str(essay.getScore(scoreName)) }
        r = self.session.post(lsrh.getHumanScoreURL(), data=json.dumps(data), headers=self.headers)
        self.trainingScoresMap[essay.essay_id] = lsrh.getIdFromResponse(r)
Exemplo n.º 2
0
 def addTrainingAnswer(self, essay):
     data = {"corpus": lsrh.getCorpusURL(self.corpus_id), "text": essay.getText()}
     r = self.session.post(lsrh.getTrainingAnswerURL(), data=json.dumps(data))
     self.trainingAnswerMap[essay.essay_id] = lsrh.getIdFromResponse(r)