Last active
July 18, 2018 12:11
-
-
Save dineybomfim/ce661322504870c73c8cb41428e0fcf2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func buildText(starting: String, length: Int, file: String) -> String { | |
var text = starting | |
let strings = loadTextFile(fileName: file) | |
.replacingOccurrences(of: "\n", with: " ") | |
.components(separatedBy: " ") | |
MarkovModel.process(transitions: strings) { matrix in | |
buildWords(with: &text, length: length, chain: matrix) | |
} | |
return text | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment