battle programmers alliance
Would you like to react to this message? Create an account in a few clicks or log in to continue.

battle programmers allianceLog in

the LivinGrimoire Artificial General Intelligence software design pattern forum

descriptionrail chatbot skill Emptyrail chatbot skill

more_horiz
based on a unique and efficient auto complete AI algorithm.
can learn
can predict
can filter input and output
can learn filter parameters

Code:

public class DiRailChatBot extends DiSkillV2 {
    private RailChatBot rcb = new RailChatBot();
    private AXCmdBreaker dialog = new AXCmdBreaker("babe");
    private UniqueItemSizeLimitedPriorityQueue filter = new UniqueItemSizeLimitedPriorityQueue();
    private AXCmdBreaker bads = new AXCmdBreaker("is bad");
    private AXCmdBreaker goods = new AXCmdBreaker("is good");
    private String filterTemp = "";

    public void setQueLim(int lim){
        filter.setLimit(lim);
    }

    @Override
    public void input(String ear, String skin, String eye) {
        // filter learn:
        filterTemp = bads.extractCmdParam(ear);
        if (!filterTemp.isEmpty()){
            filter.add(filterTemp);
            filterTemp = "";
            setSimpleAlg("i will keep that in mind");
            return;
        }
        filterTemp = goods.extractCmdParam(ear);
        if (!filterTemp.isEmpty()){
            filter.removeItem(filterTemp);
            filterTemp = "";
            setSimpleAlg("understood");
            return;
        }
        if (filter.strContainsResponse(ear)){return;} // filter in
        String temp = dialog.extractCmdParam(ear);
        if (!temp.isEmpty()){
            String result = rcb.respondDialog(temp);
            if (filter.strContainsResponse(result)){return;} // filter out
            setSimpleAlg(Eliza.PhraseMatcher.reflect(result));
            return;
        }
        rcb.learn(ear);
    }
}

descriptionrail chatbot skill EmptyRe: rail chatbot skill

more_horiz
here is the Python version
it performs wonderful.

Code:

class DiRailChatBot(DiSkillV2):
    def __init__(self):
        super().__init__()
        self.rcb: RailChatBot = RailChatBot()
        self.dialog: AXCmdBreaker = AXCmdBreaker("babe")
        self.filter: UniqueItemSizeLimitedPriorityQueue = UniqueItemSizeLimitedPriorityQueue(5)
        self.bads: AXCmdBreaker = AXCmdBreaker("is bad")
        self.goods: AXCmdBreaker = AXCmdBreaker("is good")
        self.filterTemp: str = ""

    def setQueLim(self, lim):
        self.filter.setLimit(lim)

    def input(self, ear, skin, eye):
        # filter learn:
        self.filterTemp = self.bads.extractCmdParam(ear)
        if self.filterTemp:
            self.filter.insert(self.filterTemp)
            self.filterTemp = ""
            self.setSimpleAlg("i will keep that in mind")
            return
        self.filterTemp = self.goods.extractCmdParam(ear)
        if self.filterTemp:
            self.filter.removeItem(self.filterTemp)
            self.filterTemp = ""
            self.setSimpleAlg("understood")
            return
        if self.filter.strContainsResponse(ear):
            return  # filter in
        temp = self.dialog.extractCmdParam(ear)
        if temp:
            result = self.rcb.respondDialog(temp)
            if self.filter.strContainsResponse(result):
                return  # filter out
            self.setSimpleAlg(Eliza.PhraseMatcher.reflect(result))
            return
        self.rcb.learn(ear)


the bot trains while you feed it data
to get a reply just add the word babe:
hello babe
for example

descriptionrail chatbot skill EmptyRe: rail chatbot skill

more_horiz
adding the skill is a walk in the park:
chobitObject.addSkill(DiRailChatBot())
privacy_tip Permissions in this forum:
You cannot reply to topics in this forum
power_settings_newLogin to reply