Beispiel #1
0
        // override object.Equals
        public override bool Equals(object obj)
        {
            if (obj == null || GetType() != obj.GetType())
            {
                return(false);
            }

            LexemDto t = (LexemDto)obj;

            return((Base == t.Base) && (CTag == t.CTag) && (Disamb == t.Disamb));
        }
Beispiel #2
0
        public void ReadXml(XmlReader reader)
        {
            reader.MoveToContent();

            //orth tag
            if (reader.Read() && reader.IsStartElement())
            {
                Orth = reader.ReadElementContentAsString();
            }

            //if string is parsed first time
            if (_chunkListMetaData != null)
            {
                _chunkListMetaData.NumberOfTokens += 1;
                //if word isn't in lookUpDictionary
                if (_chunkListMetaData.WordsLookupDictionary.ContainsKey(Orth))
                {
                    _chunkListMetaData.WordsLookupDictionary[Orth].Add(_chunkListMetaData.NumberOfChunks);
                }
                else
                {
                    var list = new List <int>();
                    list.Add(_chunkListMetaData.NumberOfChunks);
                    _chunkListMetaData.WordsLookupDictionary.Add(Orth, list);
                }
            }

            //lex tags
            while (reader.IsStartElement())
            {
                LexemDto lex = new LexemDto();
                lex.ReadXml(reader.ReadSubtree());
                Lexems.Add(lex);

                if (reader.NodeType == XmlNodeType.EndElement || reader.NodeType == XmlNodeType.Whitespace)
                {
                    reader.Skip();
                }
            }
        }