Ejemplo n.º 1
0
        private ISettingsDictionary SelectedDictionrary()
        {
            switch (dictionaryNameBox.Text)
            {
            case "@bot":
                return(robot.BotAsUser.Predicates);

            case "@global":
                return(robot.GlobalSettings);

            case "@get":
            case "@set":
            case "@user":
                return(robot.LastUser.Predicates);

            default:
            {
                var dict = robot.GetDictionary(dictionaryNameBox.Text);
                if (dict != null)
                {
                    return(dict);
                }
            }
            break;
            }
            if (user != null)
            {
                return(user.Predicates);
            }
            return(null);
        }
Ejemplo n.º 2
0
        public string GenFormatFactoid(string subject, string relation, object value, XmlNode templateNode)
        {
            string subj       = Entify(subject);
            var    dictionary = TheBot.GetDictionary(subj) as SettingsDictionary;

            bool      noValue = Unifiable.IsNullOrEmpty(value);
            Unifiable formatter;
            {
                if (noValue)
                {
                    // query mode
                    formatter = GetDictValue(dictionary, relation, "format-query");
                }
                else
                {
                    // assert mode
                    formatter = GetDictValue(dictionary, relation, "format-assert");
                }
            }

            var formatterUpper = Unifiable.ToUpper(formatter);

            if (Unifiable.IsNullOrEmpty(formatter) || Unifiable.IsTrueOrYes(formatterUpper) || formatter == "default")
            {
                formatter = " {0} {1} is {2} ";
            }

            if (Unifiable.IsFalseOrNo(formatterUpper))
            {
                return("false");
            }

            return(ExpandFormat(subj, relation, value, noValue, dictionary, formatter, templateNode));
        }
Ejemplo n.º 3
0
        public string FixPronouns(string myText, XmlNode templateNode)
        {
            var dict = TheBot.GetDictionary(templateNode.LocalName);

            return(TripleStoreProxy.FixPronouns(myText,
                                                dict == null
                                                    ? (Func <string, string>)null
                                                    : ((i) => dict.grabSetting(i))));
        }