コード例 #1
0
ファイル: NameGenerator.cs プロジェクト: brandongandy/manglib
        /// <summary>
        /// Repopulates the <see cref="MarkovData"/> instance with new data using values from the
        /// <see cref="Data.Names"/> namespace or your own input, with the option of setting <paramref name="tokenLength"/>
        /// and <paramref name="isPreformatted"/>. Clears the <see cref="NameList"/> on switching.
        /// </summary>
        /// <param name="nameSource">
        /// A non-empty list of strings; if empty or null then the <see cref="markovData"/>
        /// is not updated.</param>
        /// <param name="tokenLength">The length of the ngram used to generate new names. When in doubt, use 3.</param>
        /// <param name="isPreformatted">
        /// Determines whether the MarkovData constructor will sanitize the input before populating all its data.
        /// </param>
        public void SwitchSource(List <string> nameSource, int tokenLength, bool isPreformatted)
        {
            if (nameSource is null ||
                !nameSource.Any())
            {
                return;
            }

            markovData = new MarkovData(nameSource, tokenLength, isPreformatted);
            NameList.Clear();
        }
コード例 #2
0
ファイル: NameGenerator.cs プロジェクト: brandongandy/manglib
 /// <summary>
 /// Creates a new instance of the name generator with the specified "source" and token length.
 /// </summary>
 /// <param name="input">
 /// A non-empty list of strings; if empty or null then the <see cref="markovData"/>
 /// is not updated.</param>
 /// <param name="tokenLength">The length of the ngram used to generate new names. When in doubt, use 3.</param>
 public NameGenerator(IEnumerable <string> input, int tokenLength)
 {
     markovData = new MarkovData(input, tokenLength);
     NameList   = new List <string>();
 }
コード例 #3
0
ファイル: NameGenerator.cs プロジェクト: brandongandy/manglib
 /// <summary>
 /// Default constructor; defaults to use <see cref="Aztec.Female"/> names with a token length of 3.
 /// </summary>
 public NameGenerator()
 {
     markovData = new MarkovData(Aztec.Female, tokenLength: 3, true);
     NameList   = new List <string>();
 }