Exemplo n.º 1
0
        public override Synset[] GetSynsets(string lemma, string partOfSpeech)
        {
            var synsets = new List <Synset>();

            IndexWord indexWord = GetIndexWord(lemma, partOfSpeech);

            if (indexWord != null)
            {
                foreach (int synsetOffset in indexWord.SynsetOffsets)
                {
                    Synset synset = CreateSynset(partOfSpeech, synsetOffset);
                    synsets.Add(synset);
                }
            }

            return(synsets.ToArray());
        }
Exemplo n.º 2
0
        public override Synset GetSynset(string lemma, string partOfSpeech, int senseNumber)
        {
            if (senseNumber < 1)
            {
                throw new ArgumentOutOfRangeException("senseNumber", senseNumber, "cannot be less than 1");
            }

            IndexWord indexWord = GetIndexWord(lemma, partOfSpeech);

            if (indexWord != null)
            {
                if (senseNumber > (indexWord.SynsetOffsets.Length + 1))
                {
                    return(null);
                }
                Synset synset = CreateSynset(partOfSpeech, indexWord.SynsetOffsets[senseNumber - 1]);
                return(synset);
            }
            return(null);
        }
Exemplo n.º 3
0
        public override RelationType[] GetRelationTypes(string lemma, string partOfSpeech)
        {
            IndexWord indexWord = GetIndexWord(lemma, partOfSpeech);

            if (indexWord != null)
            {
                if (indexWord.RelationTypes != null)
                {
                    int relationTypeCount = indexWord.RelationTypes.Length;
                    var relationTypes     = new RelationType[relationTypeCount];
                    for (int currentRelationType = 0; currentRelationType < relationTypeCount; currentRelationType++)
                    {
                        relationTypes[currentRelationType] = _relationTypeDictionary[indexWord.RelationTypes[currentRelationType]];
                    }
                    return(relationTypes);
                }
                return(null);
            }
            return(null);
        }