예제 #1
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"));
                    }
                }
            }
        }
예제 #2
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);
        }