MSTParser.DependencyPipe.WritePossibleFeatures C# (CSharp) Метод

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

public WritePossibleFeatures ( DependencyInstance inst, BinaryWriter writer ) : void
inst DependencyInstance
writer BinaryWriter
Результат void
        public virtual void WritePossibleFeatures(DependencyInstance inst, BinaryWriter writer)
        {
            var toks = inst.Sentence;
            var pos = inst.POS;
            var labs = inst.Labs;

            var posA = new string[pos.Length];
            for (int i = 0; i < pos.Length; i++)
            {
                posA[i] = pos[i].SubstringWithIndex(0, 1);
            }

            try
            {
                for (int w1 = 0; w1 < toks.Length; w1++)
                {
                    for (int w2 = w1 + 1; w2 < toks.Length; w2++)
                    {
                        for (int ph = 0; ph < 2; ph++)
                        {
                            bool attR = ph == 0 ? true : false;

                            var childInt = attR ? w2 : w1;
                            var parInt = attR ? w1 : w2;

                            var prodFV = CreateFeatureVector(toks, pos, posA, w1, w2, attR,
                                                                       new FeatureVector());

                            foreach (Feature feature in prodFV.FVector)
                            {
                                if (feature.Index >= 0)
                                    writer.Write(feature.Index);
                            }
                            writer.Write(-2);
                        }
                    }
                }

                writer.Write(-3);

                if (Labeled)
                {
                    for (int w1 = 0; w1 < toks.Length; w1++)
                    {
                        for (int t = 0; t < Types.Length; t++)
                        {
                            string type = Types[t];

                            for (int ph = 0; ph < 2; ph++)
                            {
                                bool attR = ph == 0 ? true : false;

                                for (int ch = 0; ch < 2; ch++)
                                {
                                    bool child = ch == 0 ? true : false;

                                    var prodFV = CreateFeatureVector(toks, pos, posA, w1,
                                                                               type,
                                                                               attR, child,
                                                                               new FeatureVector());
                                    foreach (Feature feature in prodFV.FVector)
                                    {
                                        if (feature.Index >= 0)
                                            writer.Write(feature.Index);
                                    }
                                    writer.Write(-2);
                                }
                            }
                        }
                    }

                    writer.Write(-3);
                }
                foreach (Feature feature in inst.Fv.FVector)
                {
                    writer.Write(feature.Index);
                }

                writer.Write(-4);
                writer.Write(inst.Sentence.Length);
                foreach (string s in inst.Sentence)
                {
                    writer.Write(s);
                }
                writer.Write(-5);
                writer.Write(inst.POS.Length);
                foreach (string s in inst.POS)
                {
                    writer.Write(s);
                }
                writer.Write(-6);
                writer.Write(inst.Labs.Length);
                foreach (string s in inst.Labs)
                {
                    writer.Write(s);
                }
                writer.Write(-7);
                writer.Write(inst.ActParseTree);
                writer.Write(-1);
            }
            catch (IOException)
            {
            }
        }