GenerateText() public static method

public static GenerateText ( Swummary sunit ) : String
sunit Swummary
return String
Exemplo n.º 1
0
 public TextInfo Update(TextGenerationSettings tgs)
 {
     textInfo.isDirty = true;
     TextGenerator.GenerateText(tgs, textInfo);
     textGenerationSettings = tgs;
     return(textInfo);
 }
Exemplo n.º 2
0
        public static void Main()
        {
            var generator = new TextGenerator(WordTypes.Name);

            var names = generator.GenerateText(1000);
            var trie  = new Trie();
            var words = new HashSet <string>();

            names.Split(' ').ToList().ForEach(
                x =>
            {
                words.Add(x);
                trie.AddWord(x);
            });

            var result = new StringBuilder();

            foreach (var word in words.OrderBy(x => x))
            {
                int occurenceCount;
                trie.TryFindWord(word, out occurenceCount);
                result.AppendFormat("{0} -> {1} times", word, occurenceCount).AppendLine();
            }

            Console.WriteLine(result);
        }
Exemplo n.º 3
0
        public static void Show()
        {
            int[] arr = new int[]
            {
                100, 500,
                1000, 2000, 5000
            };

            foreach (int i in arr)
            {
                Console.WriteLine("Длина массива - " + i);

                string[] array = TextGenerator.GenerateText(i).Split();
                Console.WriteLine("сортировка пузырьком O(n^2) " + ", время выполнения - " +
                                  ActionTimeMeasurer.Measure(new Action(() =>
                                                                        BubbleSorter.Sort(array))));

                array = TextGenerator.GenerateText(i).Split();
                Console.WriteLine("сортировка вставками O(log(n)) " + ", время выполнения - " +
                                  ActionTimeMeasurer.Measure(new Action(() =>
                                                                        MergeSorter.Sort(array))));

                GC.Collect();
                Console.WriteLine();
            }

            Console.ReadKey();
        }
Exemplo n.º 4
0
 public VM()
 {
     SortedText      = new ObservableCollection <string>();
     SortedTextWords = new ObservableCollection <El>();
     SortTextLabel   = "Sort text";
     InputText       = "Place a text here";
     SortText        = new DelegateCommand(() =>
     {
         ClearInfo();
         SortTextLabel = "Sorting...";
         RaisePropertyChanged("SortTextLabel");
         Sort();
     });
     GenerateRandomText = new DelegateCommand(() =>
     {
         InputText = TextGenerator.GenerateText(RandomTextLength, 3);
         RaisePropertyChanged("InputText");
     });
     ClearText = new DelegateCommand(() =>
     {
         InputText = "";
         RaisePropertyChanged("InputText");
         ClearInfo();
     });
 }
        private string TituloAleatorio()
        {
            var textGenerator = new TextGenerator();

            textGenerator.MaxSentenceLength = 50;
            return(textGenerator.GenerateText(4));
        }
        private string ResumoAleatorio()
        {
            var textGenerator = new TextGenerator();

            textGenerator.MaxSentenceLength = 500;
            return(textGenerator.GenerateText(50));
        }
        private string AutorAleatorio()
        {
            var textGenerator = new TextGenerator(WordTypes.Name);

            textGenerator.MaxSentenceLength = 50;
            return(textGenerator.GenerateText(3));
        }
Exemplo n.º 8
0
    public void Spawn()
    {
        Word word = new Word(TextGenerator.GenerateText());

        WordView wordView = WordViewGenerator.InstantiateWordView();

        wordView.SetText(word.GetFullWord());

        AssignWordViewEvents(wordView, word);
        AssignWordEvents(word, wordView);

        WordsController.Add(word);
    }
Exemplo n.º 9
0
        public object LotsOfData(int count)
        {
            var textGenerator = new TextGenerator(WordTypes.Name);

            using (var bulk = DocumentStore.BulkInsert())
            {
                for (int i = 0; i < count; i++)
                {
                    bulk.Store(new Person
                    {
                        Name  = textGenerator.GenerateText(i % 2 == 0 ? 2 : 3),
                        Email = textGenerator.GenerateWord(i % 10 + 1) + "@" + textGenerator.GenerateWord(i % 7 + 2) + ".com"
                    });
                }
            }
            return(Json("Done with " + count));
        }
Exemplo n.º 10
0
    public void TestTextGenerationForSingleMethodCall()
    {
        // addUser( username, password);
        SUnit sunit = new SUnit(SUnitType.SingleMethodCall,
                                "add",
                                "user",
                                null,
                                new List <string> {
            "username", "password"
        },
                                "void");

        var sentence = TextGenerator.GenerateText(sunit);

        // Allow vaguer assertion and print output
        Assert.AreEqual("Add user given username, password.", sentence);
        Console.WriteLine(sentence);
    }
Exemplo n.º 11
0
    public void GenerateInstruction(Vector3 position, Vector3 scale)
    {
        Image[] donutInstances = new Image[5];

        for (int i = 0; i < 5; i++)
        {
            donutInstances[i] = Instantiate(donuts[i]) as Image;
            donutInstances[i].transform.position   = new Vector3(position.x + (i * 70), position.y, position.z);
            donutInstances[i].transform.localScale = scale;
            donutInstances[i].transform.SetParent(canvas.transform, false);
            donutInstances[i].gameObject.SetActive(true);
        }
        orderedInstructions [arrayCounter] = donutInstances;

        text [arrayCounter].gameObject.GetComponent <Text> ().text = generator.GenerateText();
        text[arrayCounter].gameObject.SetActive(true);

        arrayCounter++;
    }
        public void TextMustNotBeNullOrEmpty()
        {
            string text = _textGenerator.GenerateText();

            Assert.IsFalse(string.IsNullOrEmpty(text));
        }
Exemplo n.º 13
0
 public void BubbleSortText()
 {
     string[] text = TextGenerator.GenerateText(100, 5).Split();
     BubbleSorter.Sort(text);
     Assert.AreEqual(1, 1);
 }