public MarkovGenerator(string text, GeneratorParams inputParams) { //Verify input is sane if (inputParams == null) { throw new Exceptions.InvalidArguments("Null Generator Parameters"); } if (inputParams.Punctuation == null) { throw new Exceptions.InvalidArguments("Null punctuation list"); } if (inputParams.SentenceEnd == null) { throw new Exceptions.InvalidArguments("Null end of sentence"); } Punctuation = inputParams.Punctuation; SentenceEnd = inputParams.SentenceEnd; _allPunctuation = new List <char>(); _allPunctuation.AddRange(Punctuation); _allPunctuation.AddRange(SentenceEnd); _allPunctuation = new List <char>(_allPunctuation.Distinct()); _chainGenerator = new ChainGenerator(text, _allPunctuation.ToArray(), inputParams.ChainSize); _chainGenerator.GenerateChains(); _wordGenerator = new WordGenerator(_chainGenerator.Chains, inputParams.Rand); _sentenceGenerator = new WordGenerator(_chainGenerator.Chains, inputParams.Rand); }
public MarkovGenerator(string text, GeneratorParams inputParams) { //Verify input is sane if(inputParams == null) { throw new Exceptions.InvalidArguments("Null Generator Parameters") ; } if(inputParams.Punctuation == null) { throw new Exceptions.InvalidArguments("Null punctuation list") ; } if(inputParams.SentenceEnd == null) { throw new Exceptions.InvalidArguments("Null end of sentence") ; } Punctuation = inputParams.Punctuation ; SentenceEnd = inputParams.SentenceEnd ; _allPunctuation = new List<char>() ; _allPunctuation.AddRange(Punctuation) ; _allPunctuation.AddRange(SentenceEnd) ; _allPunctuation = new List<char>(_allPunctuation.Distinct()) ; _chainGenerator = new ChainGenerator(text, _allPunctuation.ToArray(), inputParams.ChainSize) ; _chainGenerator.GenerateChains() ; _wordGenerator = new WordGenerator(_chainGenerator.Chains, inputParams.Rand) ; _sentenceGenerator = new WordGenerator(_chainGenerator.Chains, inputParams.Rand) ; }