public void When_PyYo_Nn_Mdbk_Md1_MoveMdUnitAfterMdbk()
        {
            var sentence = new Sentence()
            {
                Texts = new List <Text>()
                {
                    new Text()
                    {
                        pe_tag = "PY", pe_text = "Yo"
                    },
                    new Text()
                    {
                        pe_tag = "NN", pe_text = "order"
                    },
                    new Text()
                    {
                        pe_tag = "MDBK", pe_text = "by"
                    },
                    new Text()
                    {
                        pe_tag = "", pe_text = "the"
                    },
                    new Text()
                    {
                        pe_tag = "", pe_text = "twelfth"
                    },
                    new Text()
                    {
                        pe_tag = "MD1", pe_text = "of", pe_merge_ahead = 2
                    },
                    new Text()
                    {
                        pe_tag = "", pe_text = "the"
                    },
                    new Text()
                    {
                        pe_tag = "", pe_text = "month"
                    },
                    new Text()
                    {
                        pe_tag = "BKP", pe_text = " . "
                    }
                }
            };

            var ddlUnitStrategy = new DdlUnitStrategy();

            sentence = ddlUnitStrategy.ShuffleSentence(sentence);

            Assert.That(sentence.Texts[0].pe_text, Is.EqualTo("Yo"));
            Assert.That(sentence.Texts[1].pe_text, Is.EqualTo("order"));
            Assert.That(sentence.Texts[2].pe_text, Is.EqualTo("by"));
            Assert.That(sentence.Texts[3].pe_text, Is.EqualTo("of"));
            Assert.That(sentence.Texts[4].pe_text, Is.EqualTo("the"));
            Assert.That(sentence.Texts[5].pe_text, Is.EqualTo("month"));
            Assert.That(sentence.Texts[6].pe_text, Is.EqualTo("the"));
            Assert.That(sentence.Texts[7].pe_text, Is.EqualTo("twelfth"));
            Assert.That(sentence.Texts[8].pe_text, Is.EqualTo(" . "));
        }
        public void When_PyYo_Nn_Md1_Md2_MoveUnitAfterPyYo()
        {
            var sentence = new Sentence()
            {
                Texts = new List <Text>()
                {
                    new Text()
                    {
                        pe_tag = "PY", pe_text = "Yo"
                    },
                    new Text()
                    {
                        pe_tag = "NN", pe_text = "order"
                    },
                    new Text()
                    {
                        pe_tag = "MD2", pe_text = "of", pe_merge_ahead = 5
                    },
                    new Text()
                    {
                        pe_tag = "", pe_text = "the"
                    },
                    new Text()
                    {
                        pe_tag = "", pe_text = "queen"
                    },
                    new Text()
                    {
                        pe_tag = "MD1", pe_text = "of",
                    },
                    new Text()
                    {
                        pe_tag = "", pe_text = "the"
                    },
                    new Text()
                    {
                        pe_tag = "", pe_text = "country"
                    },
                    new Text()
                    {
                        pe_tag = "BKP", pe_text = " . "
                    }
                }
            };

            var ddlUnitStrategy = new DdlUnitStrategy();

            sentence = ddlUnitStrategy.ShuffleSentence(sentence);

            Assert.That(sentence.Texts[0].pe_text, Is.EqualTo("Yo"));
            Assert.That(sentence.Texts[1].pe_text, Is.EqualTo("of"));
            Assert.That(sentence.Texts[2].pe_text, Is.EqualTo("the"));
            Assert.That(sentence.Texts[3].pe_text, Is.EqualTo("queen"));
            Assert.That(sentence.Texts[4].pe_text, Is.EqualTo("of"));
            Assert.That(sentence.Texts[5].pe_text, Is.EqualTo("the"));
            Assert.That(sentence.Texts[6].pe_text, Is.EqualTo("country"));
            Assert.That(sentence.Texts[7].pe_text, Is.EqualTo("order"));
            Assert.That(sentence.Texts[8].pe_text, Is.EqualTo(" . "));
        }
Esempio n. 3
0
        public void Shuffler_Routines_maintain_FullStop_At_end_of_sentences()
        {
            var sentence = LargeSentence;

            var clauserUnitStrategy = new ClauserUnitStrategy();

            sentence = clauserUnitStrategy.ShuffleSentence(sentence);

            var adverbUnitStrategy = new AdverbUnitStrategy();

            sentence = adverbUnitStrategy.ShuffleSentence(sentence);

            var timerUnitStrategy = new TimerUnitStrategy();

            sentence = timerUnitStrategy.ShuffleSentence(sentence);

            var mDUnitStrategy = new MdUnitStrategy();

            sentence = mDUnitStrategy.ShuffleSentence(sentence);

            var mdbkUnitStrategy = new MdbkUnitStrategy();

            sentence = mdbkUnitStrategy.ShuffleSentence(sentence);

            var mdNulThatUnitStrategy = new MdNulThatUnitStrategy();

            sentence = mdNulThatUnitStrategy.ShuffleSentence(sentence);

            var ddlUnitStrategy = new DdlUnitStrategy();

            sentence = ddlUnitStrategy.ShuffleSentence(sentence);

            var pyYoUnitStrategy = new PyYoUnitStrategy();

            sentence = pyYoUnitStrategy.ShuffleSentence(sentence);

            var percentUnitStrategy = new PercentUnitStrategy();

            sentence = percentUnitStrategy.ShuffleSentence(sentence);

            Assert.That(sentence.Texts.Last().IsSentenceEnd);
        }
        public void When_PyYo_Nn_Md1_MoveMdAfterYo()
        {
            var sentence = new Sentence()
            {
                Texts = new List <Text>()
                {
                    new Text()
                    {
                        pe_tag = "PY", pe_text = "Yo"
                    },
                    new Text()
                    {
                        pe_tag = "NN", pe_text = "order"
                    },
                    new Text()
                    {
                        pe_tag = "MD1", pe_text = "of", pe_merge_ahead = 0
                    },
                    new Text()
                    {
                        pe_tag = "", pe_text = "the"
                    },
                    new Text()
                    {
                        pe_tag = "", pe_text = "queen"
                    },
                    new Text()
                    {
                        pe_tag = "BKP", pe_text = " . "
                    }
                }
            };

            var ddlUnitStrategy = new DdlUnitStrategy();

            sentence = ddlUnitStrategy.ShuffleSentence(sentence);

            Assert.That(sentence.Texts[0].pe_tag, Is.EqualTo("PY"));
            Assert.That(sentence.Texts[1].pe_tag, Is.EqualTo("MD1"));
            Assert.That(sentence.Texts[2].pe_tag, Is.EqualTo("NN"));
        }
        public void When_PyYo_Nn_Mdbk_ChangeNothing()
        {
            var sentence = new Sentence()
            {
                Texts = new List <Text>()
                {
                    new Text()
                    {
                        pe_tag = "PY", pe_text = "Yo"
                    },
                    new Text()
                    {
                        pe_tag = "NN", pe_text = "order"
                    },
                    new Text()
                    {
                        pe_tag = "MDBK", pe_text = "by"
                    },
                    new Text()
                    {
                        pe_tag = "", pe_text = "tonight"
                    },
                    new Text()
                    {
                        pe_tag = "BKP", pe_text = " . "
                    }
                }
            };

            var ddlUnitStrategy = new DdlUnitStrategy();

            sentence = ddlUnitStrategy.ShuffleSentence(sentence);

            Assert.That(sentence.Texts[0].pe_text, Is.EqualTo("Yo"));
            Assert.That(sentence.Texts[1].pe_text, Is.EqualTo("order"));
            Assert.That(sentence.Texts[2].pe_text, Is.EqualTo("by"));
            Assert.That(sentence.Texts[3].pe_text, Is.EqualTo("tonight"));
            Assert.That(sentence.Texts[4].pe_text, Is.EqualTo(" . "));
        }
Esempio n. 6
0
        public void When_EconomicGrowth_Sentence_Shuffled_provides_Correct_Output()
        {
            var sentence = new Sentence()
            {
                Texts = new List <Text>()
                {
                    new Text {
                        pe_tag = "ADJ", pe_text = "Economic", pe_order = 10
                    },
                    new Text {
                        pe_tag = "NN", pe_text = "growth", pe_order = 20
                    },
                    new Text {
                        pe_tag = "DYN9", pe_tag_revised = "VBA", pe_text = "has", pe_order = 30
                    },
                    new Text {
                        pe_tag = "PAST", pe_text = "continued", pe_order = 40
                    },
                    new Text {
                        pe_tag = "MD", pe_tag_revised = "MD1", pe_text = "at", pe_order = 50, pe_merge_ahead = 3
                    },
                    new Text {
                        pe_tag = "PREN", pe_text = "a", pe_order = 60, pe_merge_ahead = 2
                    },
                    new Text {
                        pe_tag = "ADJ", pe_text = "moderate", pe_order = 70
                    },
                    new Text {
                        pe_tag = "NN", pe_text = "rate", pe_order = 80
                    },
                    new Text {
                        pe_tag = "TM", pe_tag_revised = "TM1", pe_text = "so far", pe_order = 90
                    },
                    new Text {
                        pe_tag = "TM", pe_tag_revised = "TM2", pe_text = "this year", pe_order = 100
                    },
                    new Text {
                        pe_tag = "BKP", pe_text = " . ", pe_order = 110
                    },
                }
            };

            var adverbUnitStrategy = new AdverbUnitStrategy();

            sentence = adverbUnitStrategy.ShuffleSentence(sentence);

            var timerUnitStrategy = new TimerUnitStrategy();

            sentence = timerUnitStrategy.ShuffleSentence(sentence);


            Assert.That(sentence.Texts[0].pe_text, Is.EqualTo("Economic"));
            Assert.That(sentence.Texts[1].pe_text, Is.EqualTo("growth"));    //NN

            Assert.That(sentence.Texts[2].pe_text, Is.EqualTo("this year")); //TM
            Assert.That(sentence.Texts[3].pe_text, Is.EqualTo("so far"));
            Assert.That(sentence.Texts[4].pe_text, Is.EqualTo("has"));       //VBA
            Assert.That(sentence.Texts[5].pe_text, Is.EqualTo("continued")); //PAST
            Assert.That(sentence.Texts[6].pe_text, Is.EqualTo("at"));
            Assert.That(sentence.Texts[7].pe_text, Is.EqualTo("a"));
            Assert.That(sentence.Texts[8].pe_text, Is.EqualTo("moderate"));
            Assert.That(sentence.Texts[9].pe_text, Is.EqualTo("rate"));
            Assert.That(sentence.Texts[10].pe_text, Is.EqualTo(" . "));

            var mDUnitStrategy = new MdUnitStrategy();

            sentence = mDUnitStrategy.ShuffleSentence(sentence);

            Assert.That(sentence.Texts[0].pe_text, Is.EqualTo("Economic"));
            Assert.That(sentence.Texts[1].pe_text, Is.EqualTo("growth"));

            Assert.That(sentence.Texts[2].pe_text, Is.EqualTo("this year")); //TM 2 & 1
            Assert.That(sentence.Texts[3].pe_text, Is.EqualTo("so far"));

            Assert.That(sentence.Texts[4].pe_text, Is.EqualTo("has"));  //VBA

            Assert.That(sentence.Texts[5].pe_text, Is.EqualTo("at"));   //MD1
            Assert.That(sentence.Texts[6].pe_text, Is.EqualTo("a"));
            Assert.That(sentence.Texts[7].pe_text, Is.EqualTo("moderate"));
            Assert.That(sentence.Texts[8].pe_text, Is.EqualTo("rate"));

            Assert.That(sentence.Texts[9].pe_text, Is.EqualTo("continued")); //PAST
            Assert.That(sentence.Texts[10].pe_text, Is.EqualTo(" . "));

            var mdbkUnitStrategy = new MdbkUnitStrategy();

            sentence = mdbkUnitStrategy.ShuffleSentence(sentence);

            var mdNulThatUnitStrategy = new MdNulThatUnitStrategy();

            sentence = mdNulThatUnitStrategy.ShuffleSentence(sentence);

            var ddlUnitStrategy = new DdlUnitStrategy();

            sentence = ddlUnitStrategy.ShuffleSentence(sentence);

            var pyYoUnitStrategy = new PyYoUnitStrategy();

            sentence = pyYoUnitStrategy.ShuffleSentence(sentence);

            var percentUnitStrategy = new PercentUnitStrategy();

            sentence = percentUnitStrategy.ShuffleSentence(sentence);

            var clauserUnitStrategy = new ClauserUnitStrategy();

            sentence = clauserUnitStrategy.ShuffleSentence(sentence);

            Assert.That(sentence.Texts[0].pe_text, Is.EqualTo("Economic"));
            Assert.That(sentence.Texts[1].pe_text, Is.EqualTo("growth"));

            Assert.That(sentence.Texts[2].pe_text, Is.EqualTo("this year")); //TM 2 & 1
            Assert.That(sentence.Texts[3].pe_text, Is.EqualTo("so far"));

            Assert.That(sentence.Texts[4].pe_text, Is.EqualTo("has"));  //VBA

            Assert.That(sentence.Texts[5].pe_text, Is.EqualTo("at"));   //MD1
            Assert.That(sentence.Texts[6].pe_text, Is.EqualTo("a"));
            Assert.That(sentence.Texts[7].pe_text, Is.EqualTo("moderate"));
            Assert.That(sentence.Texts[8].pe_text, Is.EqualTo("rate"));

            Assert.That(sentence.Texts[9].pe_text, Is.EqualTo("continued")); //PAST
            Assert.That(sentence.Texts[10].pe_text, Is.EqualTo(" . "));
        }