Exemplo n.º 1
0
        private void GenerateVocabulary(ProceduralLanguageFactory factory)
        {
            Random rng = factory.RNG;

            foreach (string word in factory.WordKeyList)
            {
                Vocabulary.Add(word, ConstructWord(rng));
            }
        }
Exemplo n.º 2
0
        private void SelectPhonotactics(ProceduralLanguageFactory factory)
        {
            Random rng = factory.RNG;

            ImplementPhonotactics(factory.Nucleus.SelectRandom(), ref NucleusChance, 0.25, rng);
            ImplementPhonotactics(factory.WordInitialOnset.SelectRandom(), ref WordInitialOnsetChance, 0.25, rng);
            ImplementPhonotactics(factory.WordMedialOnset.SelectRandom(), ref WordMedialOnsetChance, 0.75, rng);
            ImplementPhonotactics(factory.WordMedialCoda.SelectRandom(), ref WordMedialCodaChance, 0.25, rng);
            WordFinalCodaChance = WordMedialCodaChance;
            Geminates           = factory.Geminates.SelectRandom();
        }
Exemplo n.º 3
0
        private void SelectWordLengths(ProceduralLanguageFactory factory)
        {
            Random rng = factory.RNG;

            double complexityModifier = Math.Log(SyllableComplexity);
            double bias = 20 / complexityModifier * (1 + (rng.NextDouble() - rng.NextDouble() / 4));

            for (int i = 1; i < 6; i++)
            {
                WordLengths.Add(i, 1 / (0.5 + Math.Pow(Math.Abs(bias - i), 1.1)));
            }
        }
Exemplo n.º 4
0
        public ProceduralLanguage(ProceduralLanguageFactory factory)
        {
            do
            {
                SelectPhonotactics(factory);
                SelectPhonemes(factory);
            }while (SyllableComplexity < MinimumComplexity);
            SelectWordLengths(factory);
            GenerateVocabulary(factory);

            Name = GenerateLongName(factory.RNG);
        }
Exemplo n.º 5
0
        private void SelectPhonemes(ProceduralLanguageFactory factory)
        {
            Random rng = factory.RNG;

            Onsets.Clear();
            Nuclei.Clear();
            Codae.Clear();

            Phonotactics        diphthongs = factory.Diphthongs.SelectRandom();
            IEnumerable <Vowel> vowels     = factory.SelectRandomVowels();

            switch (diphthongs)
            {
            case Phonotactics.Forbidden:
                AddNuclei(vowels, 0.2, 1, rng);
                break;

            case Phonotactics.Optional:
                AddNuclei(vowels, 0.2, 1, rng);
                AddNuclei(factory.SelectMatchingDiphthongs(vowels), 0.01, 0.1, rng);
                break;

            case Phonotactics.Required:
                AddNuclei(factory.SelectMatchingDiphthongs(vowels), 0.01, 0.1, rng);
                break;
            }

            Phonotactics            clusters   = factory.ConsonantClusters.SelectRandom();
            IEnumerable <Consonant> consonants = factory.SelectRandomConsonants();

            switch (clusters)
            {
            case Phonotactics.Forbidden:
                if (AllowsOnset)
                {
                    AddOnsets(consonants, 0.2, 1, rng);
                }
                if (AllowsCoda)
                {
                    AddCodae(consonants, 0.2, 1, rng);
                }
                break;

            case Phonotactics.Optional:
                if (AllowsOnset)
                {
                    AddOnsets(consonants, 0.2, 1, rng);
                    AddOnsetClusters(factory.SelectMatchingClusters(consonants), 0.01, 0.1, rng);
                }
                if (AllowsCoda)
                {
                    AddCodae(consonants, 0.2, 1, rng);
                    AddCodaClusters(factory.SelectMatchingClusters(consonants), 0.01, 0.1, rng);
                }
                break;

            case Phonotactics.Required:
                if (AllowsOnset)
                {
                    AddOnsetClusters(factory.SelectMatchingClusters(consonants), 0.01, 0.1, rng);
                }
                if (AllowsCoda)
                {
                    AddCodaClusters(factory.SelectMatchingClusters(consonants), 0.01, 0.1, rng);
                }
                break;
            }
        }
Exemplo n.º 6
0
 public ProceduralLanguageNew(ProceduralLanguageFactory factory)
 {
 }