コード例 #1
0
ファイル: NatLangDb.cs プロジェクト: hackerlank/trunk-chatbot
        private static string GetWordInfo(string s)
        {
            CycDatabase TheCyc = CycDatabase.TheStaticCyc;

            s = ToLowerAnsii(s);
            Unifiable rs;

            if (IsStopWord(s))
            {
                rs =
                    TheCyc.EvalSubL("(cconcatenate (pos-of-string \"" + s + "\")(words-of-string \"" + s + "\"))",
                                    null);
            }
            else
            {
                rs =
                    TheCyc.EvalSubL(
                        "(cconcatenate (pos-of-string \"" + s + "\")(words-of-string \"" + s +
                        "\")(all-parsing-denots-of-string \"" + s + "\"))", null);
            }

            string ss = rs.AsString();

            if (ss.Contains("Pronoun"))
            {
                ss = ss.Replace("Det", "");
            }
            if (ss.Contains("#$Determ") || Interjections.Contains(" " + s + " "))
            {
                ss = ss.Replace("Noun", "");
            }
            ss = ss.ToLower().Replace('(', ' ').Replace(')', ' ').Replace('$', ' ');
            return(ss);
        }
コード例 #2
0
 public CycDatabase(AltBot bot)
 {
     TheStaticCyc = this;
     TheBot       = bot;
 }