<commit_before>#!/usr/bin/env python
# vim: ai ts=4 sts=4 et sw=4


from django.db import models


class Question(models.Model):
    text = models.TextField()
    
    def __unicode__(self):
        return "Q%s: %s" % (
            self.pk,
            self.text)


class Tree(models.Model):
    trigger = models.CharField(max_length=30, help_text="The incoming message which triggers this Tree")
    root_question = models.ForeignKey(Question, related_name="first_question", help_text="The first Question sent when this Tree is triggered, which may lead to many more")
    
    def __unicode__(self):
        return "T%s: %s -> %s" % (
            self.pk,
            self.trigger,
            self.root_question)


class Answer(models.Model):
    previous_question = models.ForeignKey(Question, related_name="previous_question", help_text="The Question which this Answer is an option to")
    next_question     = models.ForeignKey(Question, blank=True, null=True, related_name="next_question", help_text="The (optional) Question to proceed to when this Answer is chosen")
    trigger           = models.CharField(max_length=30, help_text="The incoming message which triggers this Answer")
    response          = models.TextField(blank=True, help_text="The message which is sent in response to this Answer, before the next question is sent")
    
    def __unicode__(self):
        return ("Q%s -> %s" % (
            self.previous_question.pk,
            self.trigger) +\
            
            # if this question has a "next question", which the<commit_msg>rejigged relationship names in apps.tree<commit_after>#!/usr/bin/env python
# vim: ai ts=4 sts=4 et sw=4


from django.db import models


class Question(models.Model):
    text = models.TextField()
    
    def __unicode__(self):
        return "Q%s: %s" % (
            self.pk,
            self.text)


class Tree(models.Model):
    trigger = models.CharField(max_length=30, help_text="The incoming message which triggers this Tree")
    root_question = models.ForeignKey(Question, related_name="tree_set", help_text="The first Question sent when this Tree is triggered, which may lead to many more")
    
    def __unicode__(self):
        return "T%s: %s -> %s" % (
            self.pk,
            self.trigger,
            self.root_question)


class Answer(models.Model):
    previous_question = models.ForeignKey(Question, related_name="answers", help_text="The Question which this Answer is an option to")
    next_question     = models.ForeignKey(Question, blank=True, null=True, related_name="next_question_set", help_text="The (optional) Question to proceed to when this Answer is chosen")
    trigger           = models.CharField(max_length=30, help_text="The incoming message which triggers this Answer")
    response          = models.TextField(blank=True, help_text="The message which is sent in response to this Answer, before the next question is sent")
    
    def __unicode__(self):
        return ("Q%s -> %s" % (
            self.previous_question.pk,
            self.trigger) +\
            
            # if this question has a "next question", which the
{'fraction_non_alphanumeric': 0.10015898251192369, 'fraction_numerical': 0.004451510333863275, 'mean_word_length': 2.9522613065326633, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7071764', 'n_tokens_mistral': 892, 'n_tokens_neox': 866, 'n_words': 271}