Esempio n. 1
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);
                        }
                    }
                }
            }
        }
Esempio n. 2
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);
					}
				}
			}
		}