Exemplo n.º 1
0
        void Walk(SynSetList synsets, SynSet fromSS, int depth)
        {
            foreach (SynSet wsense in synsets)
            {                            
                Add_WordSenses(fromSS, wsense, depth);

                if (wsense.senses != null)
                    Walk(wsense.senses, wsense, depth + 1);
            }
            
        }
Exemplo n.º 2
0
        public static int GetType(string strSense)
        {
            bool         blnIsHuman = false;
            Search       se;
            SearchType   sty;
            PartOfSpeech pos = null;

            if (strSense == "")
            {
                return(0);
            }
            string[] strarr = strSense.Split('#');

            if (strarr.Length > 1)
            {
                switch (strarr[1])
                {
                case "n":
                    pos = PartOfSpeech.of(PartsOfSpeech.Noun);
                    break;

                default:
                    // there is an error
                    break;
                }
            }


            sty = new SearchType(true, "HYPERPTR");

            //se = new Search(strarr[0], true, pos, sty, int.Parse( strarr[2]));

            se = new Search(strarr[0], true, pos, sty, int.Parse(strarr[2]));

            SynSetList slist = se.senses;

            if (slist.Count > 0)
            {
                blnIsHuman = IsHumanHelper(slist);
                if (blnIsHuman)
                {
                    return(1);
                }
                else
                {
                    return(2);
                }
            }
            else
            {
                return(0);
            }
        }
Exemplo n.º 3
0
        public static bool IsHumanHelper(SynSetList slist)
        {
            bool blnIsHuman = false;

            if (slist != null)
            {
                foreach (SynSet sset in slist)
                {
                    foreach (Lexeme lxm in sset.words)
                    {
                        if (lxm.word.ToUpper() == "PERSON" && lxm.wnsns == 1)
                        {
                            return(true);
                        }
                    }
                    blnIsHuman = blnIsHuman | IsHumanHelper(sset.senses);
                    if (blnIsHuman)
                    {
                        return(blnIsHuman);//If match found then do early exist from recursion
                    }
                }
            }
            return(blnIsHuman);
        }