Esempio n. 1
0
        RelList findVerbGroups(Index idx, RelList rellist)
        {
            int i, j, k;

            /* Read all senses */
            for (i = 0; i < idx.offs.Length; i++)
            {
                SynSet synset = new SynSet(idx.offs[i], pos, idx.wd, this, i);

                /* Look for VERBGROUP ptr(s) for this sense.  If found,
                 * create group for senses, or add to existing group. */
                for (j = 0; j < synset.ptrs.Length; j++)
                {
                    Pointer p = synset.ptrs[j];
                    if (p.ptp.mnemonic == "VERBGROUP")
                    {
                        /* Need to find sense number for ptr offset */
                        for (k = 0; k < idx.offs.Length; k++)
                        {
                            if (p.off == idx.offs[k])
                            {
                                rellist = addRelatives(idx, i, k, rellist);
                                break;
                            }
                        }
                    }
                }
            }
            return(rellist);
        }
Esempio n. 2
0
        RelList addRelatives(Index idx, int rel1, int rel2, RelList rellist)
        {
            /* If either of the new relatives are already in a relative group,
             * then add the other to the existing group (transitivity).
             *         Otherwise create a new group and add these 2 senses to it. */
            RelList rel, last = null;

            for (rel = rellist; rel != null; rel = rel.next)
            {
                if (rel.senses[rel1] || rel.senses[rel2])
                {
                    rel.senses[rel1] = rel.senses[rel2] = true;
                    /* If part of another relative group, merge the groups */
                    for (RelList r = rellist; r != null; r = r.next)
                    {
                        if (r != rel && r.senses[rel1] || r.senses[rel2])
                        {
                            rel.senses = rel.senses.Or(r.senses);
                        }
                    }
                    return(rellist);
                }
                last = rel;
            }
            rel = new RelList();
            rel.senses[rel1] = rel.senses[rel2] = true;
            if (rellist == null)
            {
                return(rel);
            }
            last.next = rel;
            return(rellist);
        }
Esempio n. 3
0
        // TDMS - relatives - synonyms of verb - grouped by similarity of meaning
        void relatives(Index idx)
        {
            RelList rellist = null;

            switch (pos.name)
            {
            case "verb":
                rellist = findVerbGroups(idx, rellist);
                doRelList(idx, rellist);
                break;
            }
        }
Esempio n. 4
0
        void doRelList(Index idx, RelList rellist)
        {
            int    i;
            bool   flag;
            SynSet synptr;
            BitSet outsenses = new BitSet(300);

            prflag = true;
            for (RelList rel = rellist; rel != null; rel = rel.next)
            {
                flag = false;
                for (i = 0; i < idx.offs.Length; i++)
                {
                    if (rel.senses[i] && !outsenses[i])
                    {
                        flag   = true;
                        synptr = new SynSet(idx.offs[i], pos, "", this, i);
                        synptr.strsns(i + 1);
                        synptr.tracePtrs(PointerType.of("HYPERPTR"), pos, 0);
                        synptr.frames.Clear();                         // TDMS 03 Jul 2006 - frames get added in wordnet.cs after filtering
                        // TDMS 11 Oct 2005 - build hierarchical results
                        senses.Add(synptr);
                        outsenses[i] = true;
                    }
                }
                if (flag)
                {
                    buf += "--------------\n";
                }
            }
            for (i = 0; i < idx.offs.Length; i++)
            {
                if (!outsenses[i])
                {
                    synptr = new SynSet(idx.offs[i], pos, "", this, i);
                    synptr.strsns(i + 1);
                    synptr.tracePtrs(PointerType.of("HYPERPTR"), pos, 0);
                    synptr.frames.Clear();                     // TDMS 03 Jul 2006 - frames get added in wordnet.cs after filtering
                    // TDMS 11 Oct 2005 - build hierarchical results
                    senses.Add(synptr);
                    buf += "---------------\n";
                }
            }
        }
Esempio n. 5
0
 public RelList(RelList n)
 {
     next = n;
 }
Esempio n. 6
0
		public RelList(RelList n)
		{
			next = n;
		}
Esempio n. 7
0
		void doRelList(Index idx, RelList rellist)
		{
			int i;
			bool flag;
			SynSet synptr;
			BitSet outsenses = new BitSet(300);
			prflag = true;
			for (RelList rel = rellist; rel != null; rel = rel.next)
			{
				flag = false;
				for (i = 0; i < idx.offs.Length; i++)
					if (rel.senses[i] && !outsenses[i])
					{
						flag = true;
						synptr = new SynSet(idx.offs[i], pos, "", this, i);
						synptr.strsns(i + 1);
						synptr.tracePtrs(PointerType.of("HYPERPTR"), pos, 0);
						synptr.frames.Clear(); // TDMS 03 Jul 2006 - frames get added in wordnet.cs after filtering
						// TDMS 11 Oct 2005 - build hierarchical results
						senses.Add(synptr);
						outsenses[i] = true;
					}
				if (flag)
					buf += "--------------\n";
			}
			for (i = 0; i < idx.offs.Length; i++)
				if (!outsenses[i])
				{
					synptr = new SynSet(idx.offs[i], pos, "", this, i);
					synptr.strsns(i + 1);
					synptr.tracePtrs(PointerType.of("HYPERPTR"), pos, 0);
					synptr.frames.Clear(); // TDMS 03 Jul 2006 - frames get added in wordnet.cs after filtering
					// TDMS 11 Oct 2005 - build hierarchical results
					senses.Add(synptr);
					buf += "---------------\n";
				}
		}
Esempio n. 8
0
		RelList addRelatives(Index idx, int rel1, int rel2, RelList rellist)
		{
			/* If either of the new relatives are already in a relative group,
			   then add the other to the existing group (transitivity).
				   Otherwise create a new group and add these 2 senses to it. */
			RelList rel, last = null;
			for (rel = rellist; rel != null; rel = rel.next)
			{
				if (rel.senses[rel1] || rel.senses[rel2])
				{
					rel.senses[rel1] = rel.senses[rel2] = true;
					/* If part of another relative group, merge the groups */
					for (RelList r = rellist; r != null; r = r.next)
						if (r != rel && r.senses[rel1] || r.senses[rel2])
							rel.senses = rel.senses.Or(r.senses);
					return rellist;
				}
				last = rel;
			}
			rel = new RelList();
			rel.senses[rel1] = rel.senses[rel2] = true;
			if (rellist == null)
				return rel;
			last.next = rel;
			return rellist;
		}
Esempio n. 9
0
		RelList findVerbGroups(Index idx, RelList rellist)
		{
			int i, j, k;
			/* Read all senses */
			for (i = 0; i < idx.offs.Length; i++)
			{
				SynSet synset = new SynSet(idx.offs[i], pos, idx.wd, this, i);
				/* Look for VERBGROUP ptr(s) for this sense.  If found,
				   create group for senses, or add to existing group. */
				for (j = 0; j < synset.ptrs.Length; j++)
				{
					Pointer p = synset.ptrs[j];
					if (p.ptp.mnemonic == "VERBGROUP")
						/* Need to find sense number for ptr offset */
						for (k = 0; k < idx.offs.Length; k++)
							if (p.off == idx.offs[k])
							{
								rellist = addRelatives(idx, i, k, rellist);
								break;
							}
				}
			}
			return rellist;
		}