Beispiel #1
0
        public bool Erfuellt(GaitoBotSession session)
        {
            if (!this.KannSchonSchliessen)
            {
                return(false);
            }
            if (this.GetIsEmpty(session))
            {
                if (this.Exists != null)
                {
                    return(this.Exists == "false");
                }
                return(this.Contains != null || this.Value == null ? false : false);
            }
            if (this.Exists != null)
            {
                return(this.Exists == "true");
            }
            string inhalt = this.GetInhalt(session);

            if (this.Value != null)
            {
                return(inhalt.ToLower() == this.Value.ToLower());
            }
            if (this.Contains != null)
            {
                return(inhalt.IndexOf(this.Contains.ToLower()) != -1);
            }
            return(false);
        }
Beispiel #2
0
 private bool GetIsEmpty(GaitoBotSession session)
 {
     if (StandardGlobaleEigenschaften.GetStandardConditionContent(this.Name) == null)
     {
         return(session.UserEigenschaften.IsEmpty(this.Name));
     }
     return(false);
 }
Beispiel #3
0
 public AntwortFinder(string[] trenner, Normalisierung normalisierer, Wissen wissen, GaitoBotSession session, GaitoBotEigenschaften botEigenschaften, bool beiEinwortEingabenOhneMatchAufSraiOnlyOneWordUmleiten)
 {
     this._beiEinwortEingabenOhneMatchAufSraiOnlyOneWordUmleiten = beiEinwortEingabenOhneMatchAufSraiOnlyOneWordUmleiten;
     this._trenner          = trenner;
     this._botEigenschaften = botEigenschaften;
     this._wissen           = wissen;
     this._session          = session;
     this._normalisierer    = normalisierer;
 }
Beispiel #4
0
        private string GetInhalt(GaitoBotSession session)
        {
            string standardConditionContent = StandardGlobaleEigenschaften.GetStandardConditionContent(this.Name);

            if (standardConditionContent == null)
            {
                return(session.UserEigenschaften.Lesen(this.Name).ToLower());
            }
            return(standardConditionContent);
        }
        public string GetAntwort(string eingabe, GaitoBotSession session)
        {
            if (eingabe == null || eingabe.Trim() == "")
            {
                eingabe = "TARGET EMPTYINPUT";
            }
            session.Denkprotokoll.Add(new BotDenkProtokollSchritt(eingabe, BotDenkProtokollSchritt.SchrittArten.Eingabe));
            AntwortFinder      antwortFinder = new AntwortFinder(this._normalisierung.StartupInfos.SatzTrenner.ToArray(), this._normalisierung, this._wissen, session, this._botEigenschaften, this._beiEinwortEingabenOhneMatchAufSraiOnlyOneWordUmleiten);
            List <AntwortSatz> list          = antwortFinder.GetAntwortSaetze(eingabe);
            StringBuilder      stringBuilder = new StringBuilder();

            if (list == null)
            {
                session.Denkprotokoll.Add(new BotDenkProtokollSchritt(ResReader.Reader(session.DenkprotokollKultur).GetString("KonnteKeineGueltigeAntwortEreugen", session.DenkprotokollKultur), BotDenkProtokollSchritt.SchrittArten.Warnung));
                list = new List <AntwortSatz>();
                list.Add(new AntwortSatz(ResReader.Reader(this.LoggingKultur).GetString("NotfallAntwort", this.LoggingKultur), true));
            }
            foreach (AntwortSatz item in list)
            {
                string[] array = item.Satz.Split('|');
                foreach (string text in array)
                {
                    GaitoBotSessionSchritt gaitoBotSessionSchritt = new GaitoBotSessionSchritt();
                    gaitoBotSessionSchritt.BotAusgabe = text;
                    if (session.LetzterSchritt != null)
                    {
                        gaitoBotSessionSchritt.That = session.LetzterSchritt.BotAusgabe;
                    }
                    else
                    {
                        gaitoBotSessionSchritt.That = string.Empty;
                    }
                    gaitoBotSessionSchritt.Topic       = session.AktuellesThema;
                    gaitoBotSessionSchritt.UserEingabe = eingabe;
                    session.AddSchritt(gaitoBotSessionSchritt);
                    if (stringBuilder.Length != 0)
                    {
                        stringBuilder.Append(" ");
                    }
                    stringBuilder.Append(text);
                }
            }
            return(stringBuilder.ToString());
        }
Beispiel #6
0
        public string GetAntwort(string eingabe, GaitoBotSession session)
        {
            if (eingabe == null || eingabe.Trim() == "")
            {
                eingabe = "TARGET EMPTYINPUT";
            }
            session.Denkprotokoll.Add(new BotDenkProtokollSchritt(eingabe, BotDenkProtokollSchritt.SchrittArten.Eingabe));
            List <AntwortSatz> antwortSatzList = new AntwortFinder(this._normalisierung.StartupInfos.SatzTrenner.ToArray(), this._normalisierung, this._wissen, session, this._botEigenschaften, this._beiEinwortEingabenOhneMatchAufSraiOnlyOneWordUmleiten).GetAntwortSaetze(eingabe);
            StringBuilder      stringBuilder   = new StringBuilder();

            if (antwortSatzList == null)
            {
                session.Denkprotokoll.Add(new BotDenkProtokollSchritt(ResReader.Reader(session.DenkprotokollKultur).GetString("KonnteKeineGueltigeAntwortEreugen", session.DenkprotokollKultur), BotDenkProtokollSchritt.SchrittArten.Warnung));
                antwortSatzList = new List <AntwortSatz>();
                antwortSatzList.Add(new AntwortSatz(ResReader.Reader(this.LoggingKultur).GetString("NotfallAntwort", this.LoggingKultur), true));
            }
            foreach (AntwortSatz antwortSatz in antwortSatzList)
            {
                string satz    = antwortSatz.Satz;
                char[] chArray = new char[1] {
                    '|'
                };
                foreach (string str in satz.Split(chArray))
                {
                    session.AddSchritt(new GaitoBotSessionSchritt()
                    {
                        BotAusgabe  = str,
                        That        = session.LetzterSchritt == null ? string.Empty : session.LetzterSchritt.BotAusgabe,
                        Topic       = session.AktuellesThema,
                        UserEingabe = eingabe
                    });
                    if ((uint)stringBuilder.Length > 0U)
                    {
                        stringBuilder.Append(" ");
                    }
                    stringBuilder.Append(str);
                }
            }
            return(stringBuilder.ToString());
        }
Beispiel #7
0
 public GaitoScriptInterpreter(GaitoBotSession gaitoBotSession)
 {
     this._gaitoBotSession = gaitoBotSession;
     this.Initialisieren();
 }
Beispiel #8
0
 private string GetInhalt(GaitoBotSession session)
 {
     return(StandardGlobaleEigenschaften.GetStandardConditionContent(this.Name) ?? session.UserEigenschaften.Lesen(this.Name).ToLower());
 }