예제 #1
1
		public void OverviewFor(string t, string p, ref bool b, ref SearchSet obj, ArrayList list)
		{
			PartOfSpeech pos = PartOfSpeech.of(p);
			SearchSet ss = WNDB.is_defined(t, pos);
			MorphStr ms = new MorphStr(t, pos);
			bool checkmorphs = false;

			checkmorphs = AddSearchFor(t, pos, list); // do a search

		    if (checkmorphs)
				HasMatch = true;

			if (!HasMatch)
			{
			    // loop through morphs (if there are any)
			    string m;
			    while ((m = ms.next()) != null)
					if (m != t)
					{
						ss = ss + WNDB.is_defined(m, pos);
						AddSearchFor(m, pos, list);
					}
			}
		    b = ss.NonEmpty;
			obj = ss;
		}
예제 #2
0
파일: util.cs 프로젝트: ywscr/MindMap
        public static SearchSet operator+(SearchSet a, SearchSet b)
        {
            SearchSet r = new SearchSet(a);

            r.b = a.b.Or(b.b);
            return(r);
        }
예제 #3
0
파일: util.cs 프로젝트: ywscr/MindMap
        public static SearchSet operator+(SearchSet a, string s)
        {
            SearchSet r = new SearchSet(a);

            r.b[PointerType.of(s).ident] = true;
            return(r);
        }
예제 #4
0
파일: util.cs 프로젝트: ywscr/MindMap
        public static SearchSet operator+(SearchSet a, PointerType p)
        {
            SearchSet r = new SearchSet(a);

            r.b[p.ident] = true;
            return(r);
        }
예제 #5
0
파일: util.cs 프로젝트: ywscr/MindMap
        // From the WordNet Manual (http://wordnet.princeton.edu/man/wnsearch.3WN.html)
        // is_defined() sets a bit for each search type that is valid for searchstr in pos,
        // and returns the resulting unsigned integer. Each bit number corresponds to a pointer
        // type constant defined in WNHOME/include/wnconsts.h . For example, if bit 2 is set,
        // the HYPERPTR search is valid for searchstr . There are 29 possible searches.
        public static SearchSet is_defined(string searchstr, PartOfSpeech fpos)
        {
            Indexes ixs = new Indexes(searchstr, fpos);
            Index   index;
            int     i;
            int     CLASS    = 22;                      /* - */
            int     LASTTYPE = CLASS;

            Search    s      = new Search(searchstr, fpos, new SearchType(false, "FREQ"), 0);
            SearchSet retval = new SearchSet();

            while ((index = ixs.next()) != null)
            {
                retval = retval + "SIMPTR" + "FREQ" + "SYNS" + "WNGREP" + "OVERVIEW";     // added WNGREP - TDMS
                for (i = 0; i < index.ptruse.Length; i++)
                {
                    PointerType pt = index.ptruse[i];
//					retval=retval+pt;

                    // WN2.1 - TDMS
                    if (pt.ident <= LASTTYPE)
                    {
                        retval = retval + pt;
                    }
                    else if (pt.mnemonic == "INSTANCE")
                    {
                        retval = retval + "HYPERPTR";
                    }
                    else if (pt.mnemonic == "INSTANCES")
                    {
                        retval = retval + "HYPOPTR";
                    }

                    // WN2.1 - TDMS
                    if (pt.mnemonic == "SIMPTR")
                    {
                        retval = retval + "ANTPTR";
                    }

                    if (fpos.name == "noun")
                    {
                        /* set generic HOLONYM and/or MERONYM bit if necessary */
                        if (pt >= "ISMEMBERPTR" && pt <= "ISPARTPTR")
                        {
                            retval = retval + "HOLONYM";
                        }
                        else if (pt >= "HASMEMBERPTR" && pt <= "HASPARTPTR")
                        {
                            retval = retval + "MERONYM";
                        }
                    }
// WN2.1 - TDMS					else if (fpos.name=="adj" && pt.mnemonic=="SIMPTR")
//						retval=retval+"ANTPTR";
                }
                if (fpos.name == "noun")
                {
                    retval = retval + "RELATIVES";
                    if (index.HasHoloMero("HMERONYM", s))
                    {
                        retval = retval + "HMERONYM";
                    }
                    if (index.HasHoloMero("HHOLONYM", s))
                    {
                        retval = retval + "HHOLONYM";
                    }
                    if (retval["HYPERPTR"])
                    {
                        retval = retval + "COORDS";
                    }
                }
                else if (fpos.name == "verb")
                {
                    retval = retval + "RELATIVES" + "FRAMES";               // added frames - TDMS
                }
            }
            return(retval);
        }
예제 #6
0
파일: util.cs 프로젝트: ywscr/MindMap
 internal SearchSet(SearchSet s)
 {
     b = new BitSet(s.b);
 }
예제 #7
0
파일: util.cs 프로젝트: cuiwanyun/KBQA
 public static SearchSet operator +(SearchSet a,SearchSet b)
 {
     SearchSet r = new SearchSet(a);
     r.b = a.b.Or(b.b);
     return r;
 }
예제 #8
0
파일: util.cs 프로젝트: cuiwanyun/KBQA
 public static SearchSet operator +(SearchSet a,PointerType p)
 {
     SearchSet r = new SearchSet(a);
     r.b[p.ident]=true;
     return r;
 }
예제 #9
0
파일: util.cs 프로젝트: cuiwanyun/KBQA
 public static SearchSet operator +(SearchSet a,string s)
 {
     SearchSet r = new SearchSet(a);
     r.b[PointerType.of(s).ident]=true;
     return r;
 }
예제 #10
0
파일: util.cs 프로젝트: cuiwanyun/KBQA
 internal SearchSet(SearchSet s)
 {
     b = new BitSet(s.b);
 }
예제 #11
0
파일: util.cs 프로젝트: cuiwanyun/KBQA
        // TDMS 16 July 2006 - removed this method.
        // Method removed because if called externally
        // WNDBPart was not correctly constructed.
        // Calling is_defined(string searchstr,PartOfSpeech fpos)
        // correctly constructs WNDBPart.
        /*
        private static SearchSet is_defined(string word,string p)
        {
            Console.WriteLine("is_defined string, string");
            return is_defined(word,PartOfSpeech.of(p));
        }
        */
        /// <summary>
        /// Determines if a word is defined in the WordNet database and returns
        /// all possible searches of the word.
        /// </summary>
        /// <example> This sample displays a message stating whether the 
        /// word "car" exists as the part of speech "noun".
        /// <code>
        /// Wnlib.WNCommon.path = "C:\Program Files\WordNet\2.1\dict\"
        /// Dim wrd As String = "car"
        /// Dim POS As String = "noun"
        /// Dim b As Boolean = Wnlib.WNDB.is_defined(wrd, Wnlib.PartOfSpeech.of(POS)).NonEmpty.ToString
        /// 
        /// If b Then
        /// 	MessageBox.Show("The word " & wrd & " exists as a " & POS & ".")
        /// Else
        /// 	MessageBox.Show("The word " & wrd & " does not exist as a " & POS & ".")
        /// End If
        /// </code>
        /// </example>
        /// <param name="searchstr">The word to search for</param>
        /// <param name="fpos">Part of Speech (noun, verb, adjective, adverb)</param>
        /// <returns>A SearchSet or null if the word does not exist in the dictionary</returns>
        public static SearchSet is_defined(string searchstr,PartOfSpeech fpos)
        {
            Indexes ixs = new Indexes(searchstr,fpos);
            Index index;
            int i;
            int CLASS =          22;	/* - */
            int LASTTYPE =	CLASS;

            Search s = new Search(searchstr,fpos,new SearchType(false,"FREQ"),0);
            SearchSet retval = new SearchSet();
            while ((index=ixs.next())!=null)
            {
                retval=retval+"SIMPTR"+"FREQ"+"SYNS"+"WNGREP"+"OVERVIEW"; // added WNGREP - TDMS
                for (i=0;i<index.ptruse.Length;i++)
                {
                    PointerType pt = index.ptruse[i];
            //					retval=retval+pt;

                    // WN2.1 - TDMS
                    if (pt.ident <= LASTTYPE) {
                        retval = retval + pt;
                    } else if (pt.mnemonic == "INSTANCE") {
                        retval = retval + "HYPERPTR";
                    } else if (pt.mnemonic == "INSTANCES") {
                        retval = retval + "HYPOPTR";
                    }

                    // WN2.1 - TDMS
                    if (pt.mnemonic == "SIMPTR") {
                        retval = retval + "ANTPTR";
                    }

                    if (fpos.name=="noun")
                    {
                        /* set generic HOLONYM and/or MERONYM bit if necessary */
                        if (pt>="ISMEMBERPTR" && pt<="ISPARTPTR")
                            retval=retval+"HOLONYM";
                        else if (pt>="HASMEMBERPTR" && pt<="HASPARTPTR")
                            retval=retval+"MERONYM";
                    }
            // WN2.1 - TDMS					else if (fpos.name=="adj" && pt.mnemonic=="SIMPTR")
            //						retval=retval+"ANTPTR";
                }
                if (fpos.name=="noun")
                {
                    retval=retval+"RELATIVES";
                    if (index.HasHoloMero("HMERONYM",s))
                        retval=retval+"HMERONYM";
                    if (index.HasHoloMero("HHOLONYM",s))
                        retval=retval+"HHOLONYM";
                    if (retval["HYPERPTR"])
                        retval = retval+"COORDS";
                }
                else if (fpos.name=="verb")
                    retval=retval+"RELATIVES"+"FRAMES"; // added frames - TDMS
            }
            return retval;
        }