Esempio n. 1
0
        public void CategoryAufnehmen(WissensCategory category)
        {
            WissenThema wissenThema = (WissenThema)this._themen[(object)category.ThemaName];

            if (wissenThema == null)
            {
                wissenThema = new WissenThema(category.ThemaName);
                this._themen.Add((object)category.ThemaName, (object)wissenThema);
            }
            wissenThema.CategoryAufnehmen(category);
        }
Esempio n. 2
0
        private AntwortSatz GetQualifizierteAntwort_(string einSatz, string that, ArrayList vorherigeSRAIs)
        {
            this._session.Denkprotokoll.Add(new BotDenkProtokollSchritt(einSatz, BotDenkProtokollSchritt.SchrittArten.Eingabe));
            if (vorherigeSRAIs.Count > 50)
            {
                return(new AntwortSatz(string.Format("SRAI-recursion at '{0}'", einSatz), false));
            }
            einSatz = this._normalisierer.StandardErsetzungenDurchfuehren(einSatz);
            einSatz = Normalisierung.EingabePatternOptimieren(einSatz, false).Trim();
            if (einSatz == "")
            {
                this._session.Denkprotokoll.Add(new BotDenkProtokollSchritt("Die Eingabe ist nach Normalisierung und Patternoptimierung leer", BotDenkProtokollSchritt.SchrittArten.Info));
                return(null);
            }
            string text = that;

            that = this._normalisierer.StandardErsetzungenDurchfuehren(that);
            if (that == "")
            {
                that = text;
            }
            else
            {
                text = that;
            }
            that = Normalisierung.EingabePatternOptimieren(that.Trim(), false);
            if (that == "")
            {
                that = text;
            }
            WissenThema thema  = this._wissen.GetThema(this._session.AktuellesThema);
            AntwortSatz result = default(AntwortSatz);

            if (thema != null)
            {
                foreach (WissensCategory category in thema.Categories)
                {
                    if (category.Pattern.Inhalt != "*" && category.That.Inhalt != "*" && this.PasstCategory(category, einSatz, that, vorherigeSRAIs, out result))
                    {
                        return(result);
                    }
                }
            }
            thema = this._wissen.GetThema(this._session.AktuellesThema);
            if (thema != null)
            {
                foreach (WissensCategory category2 in thema.Categories)
                {
                    if (category2.Pattern.Inhalt != "*" && category2.That.Inhalt == "*" && this.PasstCategory(category2, einSatz, that, vorherigeSRAIs, out result))
                    {
                        return(result);
                    }
                }
            }
            for (int i = 1; i < this._session.LetzteThemen.Count; i++)
            {
                string themaName = this._session.LetzteThemen[this._session.LetzteThemen.Count - 1 - i];
                thema = this._wissen.GetThema(themaName);
                if (thema != null)
                {
                    foreach (WissensCategory category3 in thema.Categories)
                    {
                        if (category3.IstSrai && category3.Pattern.Inhalt != "*" && category3.That.Inhalt != "*" && this.PasstCategory(category3, einSatz, that, vorherigeSRAIs, out result))
                        {
                            return(result);
                        }
                    }
                }
            }
            for (int i = 1; i < this._session.LetzteThemen.Count; i++)
            {
                string themaName = this._session.LetzteThemen[this._session.LetzteThemen.Count - 1 - i];
                thema = this._wissen.GetThema(themaName);
                if (thema != null)
                {
                    foreach (WissensCategory category4 in thema.Categories)
                    {
                        if (category4.IstSrai && category4.Pattern.Inhalt != "*" && category4.That.Inhalt == "*" && this.PasstCategory(category4, einSatz, that, vorherigeSRAIs, out result))
                        {
                            return(result);
                        }
                    }
                }
            }
            thema = this._wissen.GetThema(this._session.AktuellesThema);
            if (thema != null)
            {
                foreach (WissensCategory starCategory in thema.StarCategories)
                {
                    if (starCategory.That.Inhalt != "*" && this.PasstCategory(starCategory, einSatz, that, vorherigeSRAIs, out result))
                    {
                        return(result);
                    }
                }
            }
            for (int i = 1; i < this._session.LetzteThemen.Count; i++)
            {
                string themaName = this._session.LetzteThemen[this._session.LetzteThemen.Count - 1 - i];
                thema = this._wissen.GetThema(themaName);
                if (thema != null)
                {
                    foreach (WissensCategory category5 in thema.Categories)
                    {
                        if (category5.That.Inhalt != "*" && this.PasstCategory(category5, einSatz, that, vorherigeSRAIs, out result))
                        {
                            return(result);
                        }
                    }
                }
            }
            thema = this._wissen.GetThema(this._session.AktuellesThema);
            if (thema != null)
            {
                foreach (WissensCategory starCategory2 in thema.StarCategories)
                {
                    if (starCategory2.That.Inhalt == "*" && this.PasstCategory(starCategory2, einSatz, that, vorherigeSRAIs, out result))
                    {
                        return(result);
                    }
                }
            }
            for (int i = 1; i < this._session.LetzteThemen.Count; i++)
            {
                string themaName = this._session.LetzteThemen[this._session.LetzteThemen.Count - 1 - i];
                thema = this._wissen.GetThema(themaName);
                if (thema != null)
                {
                    foreach (WissensCategory category6 in thema.Categories)
                    {
                        if (category6.That.Inhalt == "*" && this.PasstCategory(category6, einSatz, that, vorherigeSRAIs, out result))
                        {
                            return(result);
                        }
                    }
                }
            }
            return(null);
        }
Esempio n. 3
0
        private AntwortSatz GetQualifizierteAntwort_(
            string einSatz,
            string that,
            ArrayList vorherigeSRAIs)
        {
            this._session.Denkprotokoll.Add(new BotDenkProtokollSchritt(einSatz, BotDenkProtokollSchritt.SchrittArten.Eingabe));
            if (vorherigeSRAIs.Count > 50)
            {
                return(new AntwortSatz(string.Format("SRAI-recursion at '{0}'", (object)einSatz), false));
            }
            einSatz = this._normalisierer.StandardErsetzungenDurchfuehren(einSatz);
            einSatz = Normalisierung.EingabePatternOptimieren(einSatz, false).Trim();
            if (einSatz == "")
            {
                this._session.Denkprotokoll.Add(new BotDenkProtokollSchritt("Die Eingabe ist nach Normalisierung und Patternoptimierung leer", BotDenkProtokollSchritt.SchrittArten.Info));
                return((AntwortSatz)null);
            }
            string str = that;

            that = this._normalisierer.StandardErsetzungenDurchfuehren(that);
            if (that == "")
            {
                that = str;
            }
            else
            {
                str = that;
            }
            that = Normalisierung.EingabePatternOptimieren(that.Trim(), false);
            if (that == "")
            {
                that = str;
            }
            WissenThema thema1 = this._wissen.GetThema(this._session.AktuellesThema);
            AntwortSatz antwort;

            if (thema1 != null)
            {
                foreach (WissensCategory category in thema1.Categories)
                {
                    if (category.Pattern.Inhalt != "*" && category.That.Inhalt != "*" && this.PasstCategory(category, einSatz, that, vorherigeSRAIs, out antwort))
                    {
                        return(antwort);
                    }
                }
            }
            WissenThema thema2 = this._wissen.GetThema(this._session.AktuellesThema);

            if (thema2 != null)
            {
                foreach (WissensCategory category in thema2.Categories)
                {
                    if (category.Pattern.Inhalt != "*" && category.That.Inhalt == "*" && this.PasstCategory(category, einSatz, that, vorherigeSRAIs, out antwort))
                    {
                        return(antwort);
                    }
                }
            }
            for (int index = 1; index < this._session.LetzteThemen.Count; ++index)
            {
                WissenThema thema3 = this._wissen.GetThema(this._session.LetzteThemen[this._session.LetzteThemen.Count - 1 - index]);
                if (thema3 != null)
                {
                    foreach (WissensCategory category in thema3.Categories)
                    {
                        if (category.IstSrai && category.Pattern.Inhalt != "*" && category.That.Inhalt != "*" && this.PasstCategory(category, einSatz, that, vorherigeSRAIs, out antwort))
                        {
                            return(antwort);
                        }
                    }
                }
            }
            for (int index = 1; index < this._session.LetzteThemen.Count; ++index)
            {
                WissenThema thema3 = this._wissen.GetThema(this._session.LetzteThemen[this._session.LetzteThemen.Count - 1 - index]);
                if (thema3 != null)
                {
                    foreach (WissensCategory category in thema3.Categories)
                    {
                        if (category.IstSrai && category.Pattern.Inhalt != "*" && category.That.Inhalt == "*" && this.PasstCategory(category, einSatz, that, vorherigeSRAIs, out antwort))
                        {
                            return(antwort);
                        }
                    }
                }
            }
            WissenThema thema4 = this._wissen.GetThema(this._session.AktuellesThema);

            if (thema4 != null)
            {
                foreach (WissensCategory starCategory in thema4.StarCategories)
                {
                    if (starCategory.That.Inhalt != "*" && this.PasstCategory(starCategory, einSatz, that, vorherigeSRAIs, out antwort))
                    {
                        return(antwort);
                    }
                }
            }
            for (int index = 1; index < this._session.LetzteThemen.Count; ++index)
            {
                WissenThema thema3 = this._wissen.GetThema(this._session.LetzteThemen[this._session.LetzteThemen.Count - 1 - index]);
                if (thema3 != null)
                {
                    foreach (WissensCategory category in thema3.Categories)
                    {
                        if (category.That.Inhalt != "*" && this.PasstCategory(category, einSatz, that, vorherigeSRAIs, out antwort))
                        {
                            return(antwort);
                        }
                    }
                }
            }
            WissenThema thema5 = this._wissen.GetThema(this._session.AktuellesThema);

            if (thema5 != null)
            {
                foreach (WissensCategory starCategory in thema5.StarCategories)
                {
                    if (starCategory.That.Inhalt == "*" && this.PasstCategory(starCategory, einSatz, that, vorherigeSRAIs, out antwort))
                    {
                        return(antwort);
                    }
                }
            }
            for (int index = 1; index < this._session.LetzteThemen.Count; ++index)
            {
                WissenThema thema3 = this._wissen.GetThema(this._session.LetzteThemen[this._session.LetzteThemen.Count - 1 - index]);
                if (thema3 != null)
                {
                    foreach (WissensCategory category in thema3.Categories)
                    {
                        if (category.That.Inhalt == "*" && this.PasstCategory(category, einSatz, that, vorherigeSRAIs, out antwort))
                        {
                            return(antwort);
                        }
                    }
                }
            }
            return((AntwortSatz)null);
        }