ParserTreeViewer.SNode.WriteCorpus C# (CSharp) Метод

WriteCorpus() публичный Метод

public WriteCorpus ( System wrt, string edge_type ) : void
wrt System
edge_type string
Результат void
        public void WriteCorpus( System.IO.StreamWriter wrt, string edge_type )
        {
            wrt.WriteLine( "<node>" );

               wrt.WriteLine( "<word>{0}</word>", word.word );

               if( !string.IsNullOrEmpty( edge_type ) )
               {
            wrt.WriteLine( "<link>{0}</link>", edge_type );
               }

               wrt.WriteLine( "<tag_sets>" );
               wrt.WriteLine( "<tag_set>" );
               wrt.WriteLine( "<part_of_speech>{0}</part_of_speech>", word.part_of_speech );

               foreach( string t in word.tags )
               {
            string[] t2 = t.Split( ':' );

            if( word.part_of_speech == "ГЛАГОЛ" )
            {
             if( "НАКЛОНЕНИЕ ВРЕМЯ ЛИЦО ЧИСЛО РОД".Contains( t2[0] ) )
              wrt.WriteLine( "<tag>{0}</tag>", t );
            }
            else if( word.part_of_speech == "СУЩЕСТВИТЕЛЬНОЕ" )
            {
             if( "ПАДЕЖ ЧИСЛО РОД".Contains( t2[0] ) )
              wrt.WriteLine( "<tag>{0}</tag>", t );
            }
            else if( word.part_of_speech == "МЕСТОИМЕНИЕ" )
            {
             if( "ПАДЕЖ ЧИСЛО РОД ЛИЦО".Contains( t2[0] ) )
              wrt.WriteLine( "<tag>{0}</tag>", t );
            }
            else if( word.part_of_speech == "ЧИСЛИТЕЛЬНОЕ" )
            {
             if( "ПАДЕЖ РОД".Contains( t2[0] ) )
              wrt.WriteLine( "<tag>{0}</tag>", t );
            }
            else if( word.part_of_speech == "МЕСТОИМ_СУЩ" )
            {
             if( "ПАДЕЖ".Contains( t2[0] ) )
              wrt.WriteLine( "<tag>{0}</tag>", t );
            }
            else if( word.part_of_speech == "ПРИЛАГАТЕЛЬНОЕ" )
            {
             if( "ПАДЕЖ ЧИСЛО РОД ОДУШ ФОРМА СТЕПЕНЬ".Contains( t2[0] ) )
              wrt.WriteLine( "<tag>{0}</tag>", t );
            }
            else if( word.part_of_speech == "НАРЕЧИЕ" )
            {
             if( "СТЕПЕНЬ".Contains( t2[0] ) )
              wrt.WriteLine( "<tag>{0}</tag>", t );
            }
               }

               wrt.WriteLine( "</tag_set>" );
               wrt.WriteLine( "</tag_sets>" );

               if( children != null && children.Count > 0 )
               {
            wrt.WriteLine( "<children>" );

            List<KeyValuePair<int, int>> index = new List<KeyValuePair<int, int>>();
            for( int i = 0; i < children.Count; ++i )
            {
             index.Add( new KeyValuePair<int, int>( i, children[i].word.index ) );
            }

            foreach( var i in index.OrderBy( z => z.Value ) )
            {
             children[i.Key].WriteCorpus( wrt, edge_types[i.Key] );
            }

            wrt.WriteLine( "</children>" );
               }

               wrt.WriteLine( "</node>" );
        }