Пример #1
0
        /// <summary>
        /// Trace meronyms.
        /// </summary>
        /// <param name="pbase"></param>
        /// <param name="fpos"></param>
        /// <param name="depth"></param>
        void traceInherit(PointerType pbase, PartOfSpeech fpos, int depth)
        {
            for (int i = 0; i < ptrs.Length; i++)
            {
                Pointer pt = ptrs[i];
                if (pt.ptp.ident == HYPERPTR && (pt.sce == 0 || pt.sce == whichword))
                {
                    spaces("TRACEI", depth);
                    SynSet cursyn = new SynSet(pt.off, pt.pos, this);
                    search.wordsFrom(cursyn);
                    cursyn.str("=> ", "\n", 1, 0, 0, 1);
                    // TDMS 6 Oct 2005 - build hierarchical results
                    // TODO: verify this
                    if (this.senses == null)
                    {
                        this.senses = new SynSetList();
                    }
                    cursyn.thisptr = pt;                      // TDMS 17 Nov 2005 - add this pointer type
                    // TODO: This is adding senses incorrectly
                    this.senses.Add(cursyn);

                    cursyn.tracePtrs(pbase, PartOfSpeech.of("noun"), depth);
                    cursyn.tracePtrs(pbase + 1, PartOfSpeech.of("noun"), depth);
                    cursyn.tracePtrs(pbase + 2, PartOfSpeech.of("noun"), depth);
                    if (depth > 0)
                    {
                        depth = depthcheck(depth);
                        cursyn.traceInherit(pbase, cursyn.pos, depth + 1);
                    }
                }
            }
            search.trunc();
        }
Пример #2
0
        /// <summary>
        /// Performs a search based on the parameters setup
        /// in the Search constructor.
        /// </summary>
        /// <param name="m">Specify if morphs should be searched</param>
        /// <param name="p">The Part Of Speech to perform the search on</param>
        public void do_search(bool m, string p)
        {
            if (parts == null)
            {
                parts = new Hashtable();
            }
            Search s = new Search(word, PartOfSpeech.of(p), sch, whichsense);

            s.do_search(m);
            parts[p] = s;
            buf     += s.buf;
        }
Пример #3
0
        void strAnt(string tail, AdjSynSetType attype, int definition)
        {
            int  i, wdcnt;
            bool first = true;

            if (WNOpt.opt("-o").flag)
            {
                search.buf += "(" + hereiam + ") ";
            }
            if (WNOpt.opt("-a").flag)
            {
                search.buf    += "<" + WNDB.lexfiles[fnum] + "> ";
                search.prlexid = true;
            }
            else
            {
                search.prlexid = false;
            }
            /* print antonyms from cluster head (of indirect ant) */
            search.buf += "INDIRECT (VIA ";
            for (i = 0, wdcnt = words.Length; i < wdcnt; i++)
            {
                if (first)
                {
                    strAnt(PartOfSpeech.of("adj"), i + 1, "", ", ");
                    first = false;
                }
                else
                {
                    strAnt(PartOfSpeech.of("adj"), i + 1, ", ", ", ");
                }
            }
            search.buf += ") -> ";
            /* now print synonyms from cluster head (of indirect ant) */
            for (i = 0, wdcnt = words.Length; i < wdcnt; i++)
            {
                catword(i, 0, 0);
                if (i < wdcnt - 1)
                {
                    search.buf += ", ";
                }
            }
            if (WNOpt.opt("-g").flag&& defn != null && definition != 0)
            {
                search.buf += " -- " + defn;

                isDirty = true; // TDMS 19 July 2006 - attempt to tie the logic which
                // populates buf to the logic that defines whether the
                // synset is populated with relevant information
            }
            search.buf += tail;
        }
Пример #4
0
        public MorphStr(string s, PartOfSpeech p)
        {
            string origstr = s;

            pos = p;
            if (pos.clss == "SATELLITE")
            {
                pos = PartOfSpeech.of("adj");
            }
            /* Assume string hasnt had spaces substitued with _ */
            str       = origstr.Replace(' ', '_').ToLower();
            searchstr = "";
            cnt       = str.Split('_').Length;
            svprep    = 0;
            firsttime = true;
        }
Пример #5
0
 Opt(string a, string m, string p, int h, string b)
 {
     arg = a;
     if (m[0] == '-')
     {
         sch = new SearchType(true, m.Substring(1));
     }
     else
     {
         sch = new SearchType(false, m);
     }
     pos   = PartOfSpeech.of(p.ToLower());
     helpx = h;
     label = b;
     id    = opts.Count;
     opts.Add(this);
 }
Пример #6
0
        /* From search.c:
         * Find word in index file and return parsed entry in data structure.
         * Input word must be exact match of string in database. */

        // From the WordNet Manual (http://wordnet.princeton.edu/man/wnsearch.3WN.html)
        // index_lookup() finds searchstr in the index file for pos and returns a pointer
        // to the parsed entry in an Index data structure. searchstr must exactly match the
        // form of the word (lower case only, hyphens and underscores in the same places) in
        // the index file. NULL is returned if a match is not found.
        public static Index lookup(string word, PartOfSpeech pos)
        {
            int j;

            if (word == "")
            {
                return(null);
            }
            // TDMS 14 Aug 2005 - changed to allow for numbers as well
            // because the database contains searches that can start with
            // numerals
            //if (!char.IsLetter(word[0]))
            if (!char.IsLetter(word[0]) && !char.IsNumber(word[0]))
            {
                return(null);
            }
            string line = WNDB.binSearch(word, pos);

            if (line == null)
            {
                return(null);
            }
            Index  idx = new Index();
            StrTok st  = new StrTok(line);

            idx.wd        = st.next();                  /* the word */
            idx.pos       = PartOfSpeech.of(st.next()); /* the part of speech */
            idx.sense_cnt = int.Parse(st.next());       /* collins count */
            int ptruse_cnt = int.Parse(st.next());      /* number of pointers types */

            idx.ptruse = new PointerType[ptruse_cnt];
            for (j = 0; j < ptruse_cnt; j++)
            {
                idx.ptruse[j] = PointerType.of(st.next());
            }
            int off_cnt = int.Parse(st.next());

            idx.offs         = new int[off_cnt];
            idx.tagsense_cnt = int.Parse(st.next());
            for (j = 0; j < off_cnt; j++)
            {
                idx.offs[j] = int.Parse(st.next());
            }
            return(idx);
        }
Пример #7
0
 public static PartOfSpeech of(PartsOfSpeech f)
 {
     if (f == PartsOfSpeech.Noun)
     {
         return(PartOfSpeech.of("noun"));
     }
     if (f == PartsOfSpeech.Verb)
     {
         return(PartOfSpeech.of("verb"));
     }
     if (f == PartsOfSpeech.Adj)
     {
         return(PartOfSpeech.of("adj"));
     }
     if (f == PartsOfSpeech.Adv)
     {
         return(PartOfSpeech.of("adv"));
     }
     return(null);                               // unknown or not unique
 }
Пример #8
0
        void catword(int wdnum, int adjmarker, int antflag)
        {
            search.buf += deadjify(words[wdnum].word);

            /* Print additional lexicographer information and WordNet sense
             * number as indicated by flags */
            if (words[wdnum].uniq != 0)
            {
                search.buf += "" + words[wdnum].uniq;
                isDirty     = true; // TDMS 19 July 2006 - attempt to tie the logic which
                // populates buf to the logic that defines whether the
                // synset is populated with relevant information
            }
            int s = getsearchsense(wdnum + 1);

            words[wdnum].wnsns = s;
            if (WNOpt.opt("-s").flag)
            {
                search.buf += "#" + s;
                isDirty     = true; // TDMS 19 July 2006 - attempt to tie the logic which
                // populates buf to the logic that defines whether the
                // synset is populated with relevant information
            }

            /* For adjectives, append adjective marker if present, and
             * print antonym if flag is passed */
            if (pos.name == "adj")
            {
                if (adjmarker > 0)
                {
                    search.buf += "" + adj_marker.mark;
                    isDirty     = true; // TDMS 19 July 2006 - attempt to tie the logic which
                    // populates buf to the logic that defines whether the
                    // synset is populated with relevant information
                }
                if (antflag > 0)
                {
                    strAnt(PartOfSpeech.of("adj"), wdnum + 1, "(vs. ", ")");
                }
            }
        }
Пример #9
0
        public bool HasHoloMero(PointerType p, Search search)
        {
            PointerType pbase;

            if (p.mnemonic == "HMERONYM")
            {
                pbase = PointerType.of("HASMEMBERPTR");
            }
            else
            {
                pbase = PointerType.of("ISMEMBERPTR");
            }
            for (int i = 0; i < offs.Length; i++)
            {
                SynSet s = new SynSet(offs[i], PartOfSpeech.of("noun"), "", search, 0);
                if (s.has(pbase) || s.has(pbase + 1) || s.has(pbase + 2))
                {
                    return(true);
                }
            }
            return(false);
        }
Пример #10
0
        internal void partsAll(PointerType ptp)
        {
            int         hasptr  = 0;
            PointerType ptrbase = PointerType.of((ptp.ident == HMERONYM)?"HASMEMBERPTR":"ISMEMBERPTR");

            /* First, print out the MEMBER, STUFF, PART info for this synset */
            for (int i = 0; i < 3; i++)
            {
                if (has(ptrbase + i))
                {
                    tracePtrs(ptrbase + i, PartOfSpeech.of("noun"), i);
                    hasptr++;
                }
            }

            /* Print out MEMBER, STUFF, PART info for hypernyms on
             * HMERONYM search only */
            if (hasptr > 0 && ptp.ident == HMERONYM)
            {
                search.mark();

                traceInherit(ptrbase, PartOfSpeech.of("noun"), 1);
            }
        }
Пример #11
0
        /// <summary>
        /// Trace adjective antonyms.
        /// </summary>
        internal void traceAdjAnt()
        {
            SynSet        newsynptr;
            int           i, j;
            AdjSynSetType anttype = AdjSynSetType.DirectAnt;
            SynSet        simptr, antptr;
            string        similar = "        => ";

            /* This search is only applicable for ADJ synsets which have
             * either direct or indirect antonyms (not valid for pertainyms). */
            if (sstype == AdjSynSetType.DirectAnt || sstype == AdjSynSetType.IndirectAnt)
            {
                strsns(sense + 1);
                search.buf += "\n";
                /* if indirect, get cluster head */
                if (sstype == AdjSynSetType.IndirectAnt)
                {
                    anttype = AdjSynSetType.IndirectAnt;
                    i       = 0;
                    while (ptrs[i].ptp.ident != SIMPTR)
                    {
                        i++;
                    }
                    newsynptr = new SynSet(ptrs[i].off, PartOfSpeech.of("adj"), this);
                }
                else
                {
                    newsynptr = this;
                }

                /* find antonyms - if direct, make sure that the antonym
                 * ptr we're looking at is from this word */
                for (i = 0; i < newsynptr.ptrs.Length; i++)
                {
                    if (newsynptr.ptrs[i].ptp.ident == ANTPTR && // TDMS 11 JUL 2006 // mnemonic=="ANTPTR" &&
                        ((anttype == AdjSynSetType.DirectAnt &&
                          newsynptr.ptrs[i].sce == newsynptr.whichword) ||
                         anttype == AdjSynSetType.IndirectAnt))
                    {
                        /* read the antonym's synset and print it.  if a
                         * direct antonym, print it's satellites. */
                        antptr = new SynSet(newsynptr.ptrs[i].off, PartOfSpeech.of("adj"), this);
                        search.wordsFrom(antptr);
                        // TDMS 6 Oct 2005 - build hierarchical results
                        if (this.senses == null)
                        {
                            this.senses = new SynSetList();
                        }
                        //TODO: check the ptrs reference
                        antptr.thisptr = newsynptr.ptrs[i];  // TDMS 17 Nov 2005 - add this pointer type
                        this.senses.Add(antptr);
                        if (anttype == AdjSynSetType.DirectAnt)
                        {
                            antptr.str("", "\n", 1, 0, 1, 1);
                            for (j = 0; j < antptr.ptrs.Length; j++)
                            {
                                if (antptr.ptrs[j].ptp.ident == SIMPTR) // TDMS 11 JUL 2006 - changed to INT //.mnemonic=="SIMPTR")
                                {
                                    simptr = new SynSet(antptr.ptrs[j].off, PartOfSpeech.of("adj"), this);
                                    search.wordsFrom(simptr);
                                    simptr.str(similar, "\n", 1, 0, 0, 1);
                                    // TDMS 6 Oct 2005 - build hierarchical results
                                    if (antptr.senses == null)
                                    {
                                        antptr.senses = new SynSetList();
                                    }
                                    antptr.senses.Add(simptr);
                                }
                            }
                        }
                        else
                        {
                            antptr.strAnt("\n", anttype, 1);
                        }
                    }
                }
            }
        }
Пример #12
0
 public Search(string w, bool doMorphs, string p, string s, int sn)
     :
     this(w, doMorphs, PartOfSpeech.of(p), new SearchType(s), sn)
 {
 }
Пример #13
0
 public WNHelp(string s, string p)
     : this(s, PartOfSpeech.of(p))
 {
 }
Пример #14
0
 public MorphStr(string s, string p) : this(s, PartOfSpeech.of(p))
 {
 }
Пример #15
0
 public Exceptions(string word, string p) : this(word, PartOfSpeech.of(p))
 {
 }
Пример #16
0
        string morphprep(string s)
        {
            string excWord, lastwd = null;
            int    i, offset, cnt, rest, last;
            string word, end, retval;

            /* Assume that the verb is the first word in the phrase.  Strip it
             * off, check for validity, then try various morphs with the
             * rest of the phrase tacked on, trying to find a match. */

            rest = s.IndexOf('_');
            last = s.LastIndexOf('_');
            end  = "";
            if (rest != last)
            {             // more than 2 words
                lastwd = morphword(s.Substring(last + 1));
                if (lastwd != null)
                {
                    end = s.Substring(rest, last - rest + 1) + lastwd;
                }
            }
            word = s.Substring(0, rest);
            for (i = 0; i < word.Length; i++)
            {
                if (!char.IsLetterOrDigit(word[i]))
                {
                    return(null);
                }
            }
            offset = offsets[PartOfSpeech.of("verb").ident];
            cnt    = cnts[PartOfSpeech.of("verb").ident];
            /* First try to find the verb in the exception list */
            Exceptions e = new Exceptions(word, PartOfSpeech.of("verb"));

            while ((excWord = e.next()) != null && excWord != word)
            {
                retval = excWord + s.Substring(rest);
                if (WNDB.is_defined(retval, PartOfSpeech.of("verb")).NonEmpty)
                {
                    return(retval);
                }
                else if (lastwd != null)
                {
                    retval = excWord + end;
                    if (WNDB.is_defined(retval, PartOfSpeech.of("verb")).NonEmpty)
                    {
                        return(retval);
                    }
                }
            }
            for (i = 0; i < cnt; i++)
            {
                if ((excWord = wordbase(word, i + offset)) != null && excWord != word)        // ending is different
                {
                    retval = excWord + s.Substring(rest);
                    if (WNDB.is_defined(retval, PartOfSpeech.of("verb")).NonEmpty)
                    {
                        return(retval);
                    }
                    else if (lastwd != null)
                    {
                        retval = excWord + end;
                        if (WNDB.is_defined(retval, PartOfSpeech.of("verb")).NonEmpty)
                        {
                            return(retval);
                        }
                    }
                }
            }
            retval = word + s.Substring(rest);
            if (s != retval)
            {
                return(retval);
            }
            if (lastwd != null)
            {
                retval = word + end;
                if (s != retval)
                {
                    return(retval);
                }
            }
            return(null);
        }
Пример #17
0
        static WNHelp()
        {
            PartOfSpeech noun     = PartOfSpeech.of("noun");
            PartOfSpeech verb     = PartOfSpeech.of("verb");
            PartOfSpeech adj      = PartOfSpeech.of("adj");
            PartOfSpeech adv      = PartOfSpeech.of("adv");
            string       freqhelp =
                "Display familiarity and polysemy information for the search string. \n" +
                "The polysemy count is obtained from WordNet, and is the number of \n" +
                "senses represented in the database. \n";

            noun.help["FREQ"] = freqhelp;
            verb.help["FREQ"] = freqhelp;
            adj.help["FREQ"]  = freqhelp;
            adv.help["FREQ"]  = freqhelp;
            string grephelp =
                "Print all strings in the database which contain the search string \n" +
                "as an individual word, or as the first or last string in a word or \n" +
                "collocation. \n";

            noun.help["WNGREP"]   = grephelp;
            verb.help["WNGREP"]   = grephelp;
            adj.help["WNGREP"]    = grephelp;
            adv.help["WNGREP"]    = grephelp;
            noun.help["HYPERPTR"] =
                "Display synonyms and immediate `hypernyms' of synsets containing \n" +
                "the search string.  Synsets are ordered by frequency of occurrence.  \n" +
                "\n" +
                "Hypernym is the generic term used to designate a whole class of \n" +
                "specific instances.  Y is a hypernym of X if X is a (kind of) Y. \n" +
                "\n" +
                "Hypernym synsets are preceded by \"=>\". \n";
            noun.help["RELATIVES"] =
                "Display synonyms and immediate `hypernyms' of synsets containing \n" +
                "the search string.  Synsets are grouped by similarity of meaning. \n" +
                "\n" +
                "Hypernym is the generic term used to designate a whole class of \n" +
                "specific instances.  Y is a hypernym of X if X is a (kind of) Y. \n" +
                "\n" +
                "Hypernym synsets are preceded by \"=>\". \n";
            noun.help["ANTPTR"] =
                "Display synsets containing `direct anotnyms' of the search string.  \n" +
                "\n" +
                "Direct antonyms are a pair of words between which there is an \n" +
                "associative bond built up by co-occurrences. \n" +
                "\n" +
                "Antonym synsets are preceded by \"=>\". \n";
            noun.help["COORDS"] =
                "Display the coordinates (sisters) of the search string.  This search \n" +
                "prints the immediate `hypernym' for each synset which contains the \n" +
                "search string and the hypernym's immediate `hyponyms'. \n" +
                "\n" +
                "Hypernym is the generic term used to designate a whole class of \n" +
                "specific instances.  Y is a hypernym of X if X is a (kind of) Y. \n" +
                "\n" +
                "Hyponym is the generic term used to designate a member of a class. \n" +
                "X is a hyponym of Y if X is a (kind of) Y.  \n" +
                "\n" +
                "Coordinate words are words that have the same hypernym.\n" +
                "\n" +
                "Hypernym synsets are preceded by \"->\", and hyponym synsets are \n" +
                "preceded by \"=>\". \n";
            noun.help["-HYPERPTR"] =
                "Recursively display `hypernym' (superordinate) tree for the search \n" +
                "string. \n" +
                "\n" +
                "Hypernym is the generic term used to designate a whole class of \n" +
                "specific instances.  Y is a hypernym of X if X is a (kind of) Y. \n" +
                "\n" +
                "Hypernym synsets are preceded by \"=>\", and are indented from \n" +
                "the left according to their level in the hierarchy. \n";
            noun.help["HYPOPTR"] =
                "Display immediate `hyponyms' (subordinates) for the search string. \n" +
                "\n" +
                "Hyponym is the generic term used to designate a member of a class. \n" +
                "X is a hyponym of Y if X is a (kind of) Y.  \n" +
                "\n" +
                "Hyponym synsets are preceded by \"=>\". \n";
            noun.help["-HYPOPTR"] =
                "Display `hyponym' (subordinate) tree for the search string.  This is \n" +
                "a recursive search which finds the hyponyms of each hyponym.  \n" +
                "\n" +
                "Hyponym is the generic term used to designate a member of a class. \n" +
                "X is a hyponym of Y if X is a (kind of) Y.  \n" +
                "\n" +
                "Hyponym synsets are preceded by \"=>\", and are indented from the left \n" +
                "according to their level in the hierarchy. \n";
            noun.help["HOLONYM"] =
                "Display all `holonyms' of the search string. \n" +
                "\n" +
                "A holonym is the name of the whole of which the 'meronym' names a part. \n" +
                "Y is a holonym of X if X is a part of Y. \n" +
                "\n" +
                "A meronym is the name of a constituent part, the substance of, or a \n" +
                "member of something.  X is a meronym of Y if X is a part of Y. \n" +
                "\n" +
                "Holonym synsets are preceded with either the string \"MEMBER OF\", \n" +
                "\"PART OF\" or \"SUBSTANCE OF\" depending on the specific type of holonym. \n";
            noun.help["-HHOLONYM"] =
                "Display `holonyms' for search string tree.  This is a recursive search \n" +
                "that prints all the holonyms of the search string and all of the \n" +
                "holonym's holonyms. \n" +
                "\n" +
                "A holonym is the name of the whole of which the `meronym' names a part. \n" +
                "Y is a holonym of X if X is a part of Y. \n" +
                "\n" +
                "A meronym is the name of a constituent part, the substance of, or a \n" +
                "member of something.  X is a meronym of Y if X is a part of Y. \n" +
                "\n" +
                "Holonym synsets are preceded with either the string \"MEMBER OF\", \n" +
                "\"PART OF\" or \"SUBSTANCE OF\" depending on the specific \n" +
                "type of holonym.  Synsets are indented from the left according to \n" +
                "their level in the hierarchy. \n";
            noun.help["MERONYM"] =
                "Display all `meronyms' of the search string.  \n" +
                "\n" +
                "A meronym is the name of a constituent part, the substance of, or a \n" +
                "member of something.  X is a meronym of Y if X is a part of Y. \n" +
                "\n" +
                "A holonym is the name of the whole of which the `meronym' names a part. \n" +
                "Y is a holonym of X if X is a part of Y. \n" +
                "\n" +
                "Meronym synsets are preceded with either the string \"HAS MEMBER\", \n" +
                "\"HAS PART\" or \"HAS SUBSTANCE\" depending on the specific type of holonym. \n";
            noun.help["-HMERONYM"] =
                "Display `meronyms' for search string tree.  This is a recursive search \n" +
                "the prints all the meronyms of the search string and all of its \n" +
                "`hypernyms'.  \n" +
                "\n" +
                "A meronym is the name of a constituent part, the substance of, or a \n" +
                "member of something.  X is a meronym of Y if X is a part of Y. \n" +
                "\n" +
                "A holonym is the name of the whole of which the `meronym' names a part. \n" +
                "Y is a holonym of X if X is a part of Y. \n" +
                "\n" +
                "Hypernym is the generic term used to designate a whole class of \n" +
                "specific instances.  Y is a hypernym of X if X is a (kind of) Y. \n" +
                "\n" +
                "Meronym synsets are preceded with either the string \"HAS MEMBER\", \n" +
                "\"HAS PART\" or \"HAS SUBSTANCE\" depending on the specific type of \n" +
                "holonym.  Synsets are indented from the left according to their level \n" +
                "in the hierarchy. \n";
            noun.help["ATTRIBUTE"] =
                "Display adjectives for which search string is an attribute. \n";
            verb.help["HYPERPTR"] =
                "Display synonyms and immediate `troponyms' of synsets containing \n" +
                "the search string.  \n" +
                "\n" +
                "A troponym is a verb expressing a specific manner elaboration of another \n" +
                "verb.  X is a troponym of Y if to X is to Y in some manner. \n" +
                "\n" +
                "Troponym synsets are preceded by \"=>\". \n";
            verb.help["VERBGROUP"] =
                "Display synonyms and immediate `troponyms' of synsets containing \n" +
                "the search string.  Synsets are grouped by similarity of meaning. \n" +
                "\n" +
                "A troponym is a verb expressing a specific manner elaboration of another \n" +
                "verb.  X is a troponym of Y if to X is to Y in some manner. \n" +
                "\n" +
                "Troponym synsets are preceded by \"=>\". \n";
            verb.help["ANTPTR"] =
                "Display synsets containing `direct anotnyms' of the search string.  \n" +
                "\n" +
                "Direct antonyms are a pair of words between which there is an \n" +
                "associative bond built up by co-occurrences. \n" +
                "\n" +
                "Antonym synsets are preceded by \"=>\". \n";
            verb.help["-HYPERPTR"] =
                "Recursively display `hypernym' tree for the search string.  For verbs,\n" +
                "'hypernyms' are refered to as `troponyms'. \n" +
                "\n" +
                "A troponym is a verb expressing a specific manner elaboration of another \n" +
                "verb.  X is a troponym of Y if to X is to Y in some manner. \n" +
                "\n" +
                "Troponym synsets are preceded by \"=>\". \n" +
                "\n" +
                "Troponym synsets are preceded by \"=>\", and are indented from \n" +
                "the left according to their level in the hierarchy. \n";
            verb.help["-HYPOPTR"] =
                "Display `hyponym' tree for the search string.  This is \n" +
                "a recursive search which finds the hyponyms of each hyponym.  \n" +
                "\n" +
                "For verbs, hyponyms indicate particular ways to perform a function. \n" +
                "X is a hyponym of Y if to X is a particular way to Y. \n" +
                "\n" +
                "Hyponym synsets are preceded by \"=>\", and are indented from the left \n" +
                "according to their level in the hierarchy. \n";
            verb.help["ENTAILPTR"] =
                "Recursively display `entailment' relations of the search string.  \n" +
                "\n" +
                "The action represented by the verb X entails Y if X cannot be done \n" +
                "unless Y is, or has been, done. \n" +
                "\n" +
                "Entailment synsets are preceded by \"=>\", and are indented from the left \n" +
                "according to their level in the hierarchy. \n";
            verb.help["CAUSETO"] =
                "Recursively display `cause to' relations of the search string. \n" +
                "\n" +
                "The action represented by the verb X causes the action represented by \n" +
                "the verb Y. \n" +
                "\n" +
                "`Cause to' synsets are preceded by \"=>\", and are indented from the left \n" +
                "according to their level in the hierarch.  \n";
            verb.help["FRAMES"] =
                "Display applicable verb sentence `frames' for the search string. \n" +
                "\n" +
                "A frame is a sentence template illustrating the usage of a verb. \n" +
                "\n" +
                "Verb sentence frames are preceded with the string \"*>\" if a sentence \n" +
                "frame is acceptable for all of the words in the synset, and with \"=>\" \n" +
                "if a sentence frame is acceptable for the search string only.  \n";
            adj.help["SIMPTR"] =
                "Display synonyms and synsets related to synsets containing \n" +
                "the search string.  If the search string is in a `head synset' \n" +
                "the 'cluster's' `satellite synsets' are displayed.  If the search \n" +
                "string is in a satellite synset, its head synset is displayed. \n" +
                "If the search string is a `pertainym' the word or synset that it \n" +
                "pertains to is displayed. \n" +
                "\n" +
                "A cluster is a group of adjective synsets that are organized around \n" +
                "antonymous pairs or triplets.  An adjective cluster contains two or more \n" +
                "head synsets which contan antonyms.  Each head synset has one or more \n" +
                "satellite synsets. \n" +
                "\n" +
                "A head synset contains at least one word which has a `direct antonym' \n" +
                "in another head synset of the same cluster. \n" +
                "\n" +
                "A satellite synset represents a concept that is similar in meaning to \n" +
                "the concept represented by its head synset. \n" +
                "\n" +
                "Direct antonyms are a pair of words between which there is an \n" +
                "associative bond built up by co-occurrences. \n" +
                "\n" +
                "Direct antonyms are printed in parentheses following the adjective. \n" +
                "The position of an adjective in relation to the noun may be restricted \n" +
                "to the prenominal, postnominal or predicative position.  Where present \n" +
                "these restrictions are noted in parentheses. \n" +
                "\n" +
                "A pertainym is a relational adjective, usually defined by such phrases \n" +
                "as \"of or pertaining to\" and which does not have an antonym.  It pertains \n" +
                "to a noun or another pertainym. \n" +
                "\n" +
                "Senses contained in head synsets are displayed above the satellites, \n" +
                "which are indented and preceded by \"=>\".  Senses contained in \n" +
                "satellite synsets are displayed with the head synset below.  The head \n" +
                "synset is preceded by \"=>\". \n" +
                "\n" +
                "Pertainym senses display the word or synsets that the search string \n" +
                "pertains to. \n";
            adj.help["ANTPTR"] =
                "Display synsets containing antonyms of the search string. If the \n" +
                "search string is in a `head synset' the `direct antonym' is displayed \n" +
                "along with the head synset's `satellite synsets'.  If the search \n" +
                "string is in a satellite synset, its indirect antonym is displayed \n" +
                "via the head synset \n" +
                "\n" +
                "A head synset contains at least one word which has a `direct antonym' \n" +
                "in another head synset of the same cluster. \n" +
                "\n" +
                "A satellite synset represents a concept that is similar in meaning to \n" +
                "the concept represented by its head synset. \n" +
                "\n" +
                "Direct antonyms are a pair of words between which there is an \n" +
                "associative bond built up by co-occurrences. \n" +
                "\n" +
                "Direct antonyms are printed in parentheses following the adjective. \n" +
                "The position of an adjective in relation to the noun may be restricted \n" +
                "to the prenominal, postnominal or predicative position.  Where present \n" +
                "these restrictions are noted in parentheses. \n" +
                "\n" +
                "Senses contained in head synsets are displayed, followed by the \n" +
                "head synset containing the search string's direct antonym and its \n" +
                "similar synsets, which are indented and preceded by \"=>\".  Senses \n" +
                "contained in satellite synsets are displayed followed by the indirect \n" +
                "antonym via the satellite's head synset. \n";
            adj.help["ATTRIBUTE"] =
                "Display nouns which are attributes of search string. \n";
            adv.help["SIMPTR"] =
                "Display synonyms and synsets related to synsets containing \n" +
                "the search string.  If the search string is a `pertainym' the word \n" +
                "or synset that it pertains to is displayed. \n" +
                "\n" +
                "A pertainym is a relational adverb which is derived from an adjective. \n" +
                "\n" +
                "Pertainym senses display the word that the search string is derived from \n" +
                "and the adjective synset which contains the word.  If the adjective synset \n" +
                "is a satellite synset, its head synset is also displayed. \n";
            adv.help["ANTPTR"] =
                "Display synsets containing `direct antonyms' of the search string.  \n" +
                "\n" +
                "Direct antonyms are a pair of words between which there is an \n" +
                "associative bond built up by co-occurrences. \n" +
                "\n" +
                "Antonym synsets are preceded by \"=>\". \n";
        }
Пример #18
0
        void Parse(string s, PartOfSpeech fpos, string word)
        {
            int    j;
            StrTok st  = new StrTok(s);
            int    off = int.Parse(st.next());

            fnum = int.Parse(st.next());
            string       f   = st.next();
            PartOfSpeech pos = PartOfSpeech.of(f);

            if (pos.clss == "SATELLITE")
            {
                sstype = AdjSynSetType.IndirectAnt;
            }
            int wcnt = int.Parse(st.next(), NumberStyles.HexNumber);

            words = new Lexeme[wcnt];
            for (j = 0; j < wcnt; j++)
            {
                words[j]      = new Lexeme();
                words[j].word = st.next();
                words[j].uniq = int.Parse(st.next(), NumberStyles.HexNumber);

                // Thanh Dao 7 Nov 2005 - Added missing word sense values
                int ss = getsearchsense(j + 1);
                words[j].wnsns = ss;

                if (words[j].word.ToLower() == word)
                {
                    whichword = j + 1;
                }
            }
            int pcnt = int.Parse(st.next());

            ptrs = new Pointer[pcnt];
            for (j = 0; j < pcnt; j++)
            {
                string p = st.next();
                ptrs[j] = new Pointer(p);
                if (fpos.name == "adj" && sstype == AdjSynSetType.DontKnow)
                {
                    if (ptrs[j].ptp.ident == ANTPTR)                     // TDMS 11 JUL 2006 - change comparison to int //.mnemonic=="ANTPTR")
                    {
                        sstype = AdjSynSetType.DirectAnt;
                    }
                    else if (ptrs[j].ptp.ident == PERTPTR)                   // TDMS 11 JUL 2006 - change comparison to int //mnemonic=="PERTPTR")
                    {
                        sstype = AdjSynSetType.Pertainym;
                    }
                }
                ptrs[j].off = int.Parse(st.next());
                ptrs[j].pos = PartOfSpeech.of(st.next());
                int sx = int.Parse(st.next(), NumberStyles.HexNumber);
                ptrs[j].sce = sx >> 8;
                ptrs[j].dst = sx & 0xff;
            }
            f = st.next();
            if (f != "|")
            {
                int fcnt = int.Parse(f);
                for (j = 0; j < fcnt; j++)
                {
                    f = st.next();                     // +
                    Frame fr = Frame.frame(int.Parse(st.next()));
                    frames.Add(new SynSetFrame(fr, int.Parse(st.next(), NumberStyles.HexNumber)));
                }
                f = st.next();
            }
            defn = s.Substring(s.IndexOf('|') + 1);
        }