Exemplo n.º 1
0
        internal void Seealso()
        {
            /* Find all SEEALSO pointers from the searchword and print the
             * word or synset pointed to. */
            string prefix;             // = "      Also See-> ";

            //WN3.0 added updated wording for verb see also
            if (pos.Key == "verb")
            {
                prefix = "      Phrasal Verb-> ";
            }
            else
            {
                prefix = "      Also See-> ";
            }

            for (int i = 0; i < ptrs.Length; i++)
            {
                Pointer p = ptrs[i];
                if (p.ptp.Ident == SEEALSOPTR &&
                    (p.sce == 0 || (p.sce == whichword)))
                {
                    SynonymSet cursyn      = new SynonymSet(p.off, p.pos, "", this, netData);
                    bool       svwnsnsflag = WordNetOption.Opt("-s").flag;
                    WordNetOption.Opt("-s").flag = true;
                    cursyn.Str(prefix, "", 0, (p.dst == 0) ? 0 : p.dst, 0, 0);
                    prefix = "; ";
                }
            }
        }
Exemplo n.º 2
0
        internal void StrAnt(PartOfSpeech pos, int wdnum, string head, string tail)
        {
            int i, j, wdoff;

            /* Go through all the pointers looking for anotnyms from the word
             * indicated by wdnum.  When found, print all the antonym's
             * antonym pointers which point back to wdnum. */
            for (i = 0; i < ptrs.Length; i++)
            {
                Pointer pt = ptrs[i];
                if (pt.ptp.Ident == ANTPTR && pt.sce == wdnum)
                {
                    SynonymSet psyn = new SynonymSet(pt.off, pos, this, netData);
                    for (j = 0; j < psyn.ptrs.Length; j++)
                    {
                        Pointer ppt = psyn.ptrs[j];
                        if (ppt.ptp.Ident == ANTPTR &&
                            ppt.dst == wdnum &&
                            ppt.off == hereiam)
                        {
                            wdoff       = ppt.sce > 0 ? ppt.sce - 1 : 0;
                            search.buf += head;

                            /* Construct buffer containing formatted antonym,
                             * then add it onto end of return buffer */
                            search.buf += Deadjify(psyn.words[wdoff].word);

                            /* Print additional lexicographer information and
                             * WordNet sense number as indicated by flags */
                            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 (search.prlexid && psyn.words[wdoff].uniq != 0)
                            {
                                search.buf += psyn.words[wdoff].uniq;
                            }

                            int s = Getsearchsense(wdoff + 1);
                            psyn.words[wdoff].wnsns = s;
                            if (WordNetOption.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
                            }
                            search.buf += tail;
                        }
                    }
                }
            }
        }
Exemplo n.º 3
0
        private void StrAnt(string tail, AdjSynSetType attype, int definition)
        {
            int  i, wdcnt;
            bool first = true;

            if (WordNetOption.Opt("-o").flag)
            {
                search.buf += "(" + hereiam + ") ";
            }

            search.prlexid = WordNetOption.Opt("-a").flag;
            if (search.prlexid)
            {
                search.buf    += "<" + netData.lexfiles[fnum] + "> ";
                search.prlexid = true;
            }

            /* 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 (WordNetOption.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;
        }
Exemplo n.º 4
0
        private void Strsense(int sense)
        {
            /* Append lexicographer filename after Sense # if flag is set. */
            if (WordNetOption.Opt("-a").flag)
            {
                search.buf += "\nSense " + sense + " in file \"" + netData.lexfiles[fnum] + "\"\n";
            }
            else
            {
                search.buf += "\nSense " + sense + "\n";
            }

            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
        }
Exemplo n.º 5
0
        internal void Str(string head, string tail, int definition, int wdnum, int antflag, int markerflag)
        {
            int i, wdcnt;

            search.buf += head;

            /* Precede synset with additional information as indicated
             * by flags */
            if (WordNetOption.Opt("-o").flag)
            {
                search.buf += "(" + hereiam + ") ";
            }

            search.prlexid = WordNetOption.Opt("-a").flag;
            if (search.prlexid)
            {
                search.buf += "<" + netData.lexfiles[fnum] + "> ";
            }

            if (wdnum > 0)
            {
                Catword(wdnum - 1, markerflag, antflag);
            }
            else
            {
                for (i = 0, wdcnt = words.Length; i < wdcnt; i++)
                {
                    Catword(i, markerflag, antflag);
                    if (i < wdcnt - 1)
                    {
                        search.buf += ", ";
                    }
                }
            }

            if (definition != 0 && WordNetOption.Opt("-g").flag&& defn != null)
            {
                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;
        }
Exemplo n.º 6
0
        private 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 (WordNetOption.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.Key == "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. ", ")");
                }
            }
        }