MCPcopy
hub / github.com/gunthercox/ChatterBot / create

Method create

chatterbot/storage/mongodb.py:176–190  ·  view source on GitHub ↗

Creates a new statement matching the keyword arguments specified. Returns the created statement.

(self, **kwargs)

Source from the content-addressed store, hash-verified

174 yield self.mongo_to_object(match)
175
176 def create(self, **kwargs):
177 """
178 Creates a new statement matching the keyword arguments specified.
179 Returns the created statement.
180 """
181 Statement = self.get_model('statement')
182
183 if 'tags' in kwargs:
184 kwargs['tags'] = list(set(kwargs['tags']))
185
186 inserted = self.statements.insert_one(kwargs)
187
188 kwargs['id'] = inserted.inserted_id
189
190 return Statement(**kwargs)
191
192 def create_many(self, statements):
193 """

Calls 2

StatementClass · 0.90
get_modelMethod · 0.80