Пример #1
0
        private Sentence SingleSimpleSentence(string punct = null)
        {
            int howMany = 1;

            if (random.Next(0, 100) < 10)
            {
                howMany = 2;
            }
            else if (random.Next(0, 100) < 20)
            {
                howMany = 3;
            }
            PredicateList pl = new PredicateList();

            while (howMany > 0)
            {
                var p = GeneratePredicate();
                pl.Add(p);
                howMany--;
            }

            SentenceOptionalParts parts = OptionalParts(punct);

            if (parts != null)
            {
                if (punct == "NONE")
                {
                    parts.Punctuation = null;
                }
            }

            Sentence s = new Sentence(RandomEnPiChain(), pl, SentenceDiagnostics.NotFromParser, parts);

            return(s);
        }
Пример #2
0
        public SentenceOptionalParts OptionalParts(string punct = null)
        {
            if (random.Next(0, 100) < 75)
            {
                if (punct != null && punct != "NONE")
                {
                    return(new SentenceOptionalParts {
                        Punctuation = new Punctuation(punct)
                    });
                }
                return(null);
            }
            SentenceOptionalParts sop = new SentenceOptionalParts();

            sop.Fragments = RandomEnPiChain();
            if (random.Next(0, 100) < 25)
            {
                if (random.Next(0, 100) < 50)
                {
                    sop.Conjunction = Particles.taso;
                }
                else
                {
                    sop.Conjunction = Particles.anu;
                }
            }
            int isQuestion = random.Next(0, 100);

            if (isQuestion < 30)
            {
                sop.Punctuation = new Punctuation(".");
            }
            else if (isQuestion < 60)
            {
                sop.Punctuation = new Punctuation(":");
            }
            else
            {
                if (random.Next(0, 100) < 50)
                {
                    sop.TagQuestion = new TagQuestion();
                }
                sop.Punctuation = new Punctuation("?");
            }

            if (sop.Punctuation == null && punct != null)
            {
                sop.Punctuation = new Punctuation(punct);
            }
            //tag
            return(sop);
        }