Skip to content

Commit

Permalink
Merge ab16d1b into 1854b4b
Browse files Browse the repository at this point in the history
  • Loading branch information
gunthercox committed Oct 13, 2018
2 parents 1854b4b + ab16d1b commit d0f79eb
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 2 deletions.
2 changes: 2 additions & 0 deletions chatterbot/conversation.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ def serialize(self):
return {
'id': self.id,
'text': self.text,
'stemmed_text': self.stemmed_text,
'created_at': self.created_at.isoformat().split('+', 1)[0],
'conversation': self.conversation,
'in_response_to': self.in_response_to,
Expand Down Expand Up @@ -51,6 +52,7 @@ def __init__(self, **kwargs):
self.id = kwargs.get('id')

self.text = text
self.stemmed_text = kwargs.get('stemmed_text', '')

self.conversation = kwargs.get('conversation', '')

Expand Down
7 changes: 5 additions & 2 deletions chatterbot/ext/django_chatterbot/abstract_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,12 @@ class AbstractBaseStatement(models.Model, StatementMixin):
"""

text = models.CharField(
max_length=constants.STATEMENT_TEXT_MAX_LENGTH
)

stemmed_text = models.CharField(
max_length=constants.STATEMENT_TEXT_MAX_LENGTH,
blank=False,
null=False
blank=True
)

conversation = models.CharField(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('django_chatterbot', '0015_statement_persona'),
]

operations = [
migrations.AddField(
model_name='statement',
name='stemmed_text',
field=models.CharField(blank=True, max_length=400),
),
]
6 changes: 6 additions & 0 deletions chatterbot/ext/sqlalchemy_app/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,12 @@ class Statement(Base, StatementMixin):
String(constants.STATEMENT_TEXT_MAX_LENGTH)
)

stemmed_text = Column(
String(constants.STATEMENT_TEXT_MAX_LENGTH),
nullable=False,
server_default=''
)

conversation = Column(
String(constants.CONVERSATION_LABEL_MAX_LENGTH),
nullable=False,
Expand Down

0 comments on commit d0f79eb

Please sign in to comment.