コード例 #1
0
        private List <string> GetSimilarSubjectsold(string sSubj)
        {
            List <string> lstSubjs = new List <string>();

            lstSubjs.Add(sSubj);
            int    i = 0;
            string sTempSubj;

            while (i < lstSubjs.Count)
            {
                sTempSubj = lstSubjs[i];
                foreach (Map map in lstSimilar)
                {
                    if (map.Type != "is")
                    {
                        if (map.Subject == sTempSubj)
                        {
                            UtilMap.AddItemToList(map.Subjvalue, ref lstSubjs);
                        }
                        else if (map.Subjvalue == sTempSubj)
                        {
                            UtilMap.AddItemToList(map.Subject, ref lstSubjs);
                        }
                    }
                }
                i++;
            }
            return(lstSubjs);
        }
コード例 #2
0
        public void ReadData(string sCSVPath)
        {
            List <CSV> lstCSV = File.ReadAllLines(sCSVPath)
                                .Skip(1)
                                .Select(v => CSV.FromCsv(v))
                                .ToList();

            string sSubj = "";
            string sObj  = "";
            string col1val;
            string col2val;

            foreach (CSV csv in lstCSV)
            {
                sSubj   = "";
                sObj    = "";
                col1val = csv.Col1.Trim();
                col2val = csv.Col2.Trim();

                if (UtilMap.IsContains(col2val, "is a verb"))
                {
                    lstVerbs.Add(new Single(UtilMap.RemoveText(col2val, "is a verb")));
                }
                else if (UtilMap.IsContains(col2val, "behave similar as"))
                {
                    if (UtilMap.SuppressText(col2val, "behave similar as", ref sSubj, ref sObj))
                    {
                        lstSimilar.Add(new Map(sSubj, sObj, "behave"));
                    }
                }
                else if (UtilMap.IsContains(col2val, "is similar to"))
                {
                    if (UtilMap.SuppressText(col2val, "is similar to", ref sSubj, ref sObj))
                    {
                        lstSimilar.Add(new Map(sSubj, sObj, "is"));
                    }
                }
                else if (UtilMap.IsContains(col2val, "oppose with"))
                {
                    if (UtilMap.SuppressText(col2val, "oppose with", ref sSubj, ref sObj))
                    {
                        lstOpposite.Add(new Map(sSubj, sObj, "oppose"));
                    }
                }
                else if (UtilMap.IsContains(col2val, " can "))
                {
                    if (UtilMap.SuppressText(col2val, " can ", ref sSubj, ref sObj))
                    {
                        lstCans.Add(new Map(sSubj, sObj, "can"));
                    }
                }
            }
        }
コード例 #3
0
        public string GetProcessStatementType(string sFull)
        {
            string pType = "";

            foreach (string str in lstProcessVerbs)
            {
                if (UtilMap.IsContains(sFull, str))
                {
                    pType = UtilMap.GetFirstWord(str);
                    break;
                }
            }
            return(pType);
        }
コード例 #4
0
        private bool ProcessCan(string sFull)
        {
            bool   isCan = false;
            string sVerb = "";
            string sSubj = "";

            UtilMap.SuppressText(sFull, " can ", ref sSubj, ref sVerb);
            List <string> verbs = GetSimilarVerbs(sSubj);

            foreach (string vrb in verbs)
            {
                if (vrb == sVerb)
                {
                    isCan = true;
                }
            }
            return(isCan);
        }