-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added system adapter for case when database is empty.
This is a new adapter that is now added by default when a new bot is created. The adapter is given the highest priority and will return a confidence value based on if there is data in the database.
- Loading branch information
1 parent
733d143
commit d30d565
Showing
8 changed files
with
52 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
from .logic import LogicAdapter | ||
|
||
|
||
class NoKnowledgeAdapter(LogicAdapter): | ||
""" | ||
This is a system adapter that is automatically added | ||
to the list of logic adapters durring initialization. | ||
This adapter is placed at the beginning of the list | ||
to be given the highest priority. | ||
""" | ||
|
||
def process(self, statement): | ||
""" | ||
If there are no known responses in the database, | ||
then a confidence of 1 should be returned with | ||
the input statement. | ||
Otherwise, a confidence of 0 should be returned. | ||
""" | ||
|
||
if self.context.storage.count(): | ||
return 0, statement | ||
|
||
return 1, statement |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters