changed text to A Thousand Plateaus

This commit is contained in:
notnull 2021-07-21 15:36:51 -04:00
parent 841180be34
commit f980a69c4d
4 changed files with 26851 additions and 20 deletions

Binary file not shown.

26831
deluze.txt Normal file

File diff suppressed because it is too large Load Diff

38
main.go
View File

@ -8,13 +8,13 @@ import (
"strings"
)
func readText(filename string) []string {
func readFile(filename string) []string {
f, _ := os.Open(filename)
defer f.Close()
scanner := bufio.NewScanner(f)
scanner.Split(bufio.ScanWords)
words := make([]string, 0)
var words []string
for scanner.Scan() {
words = append(words, strings.ToLower(scanner.Text()))
}
@ -22,9 +22,9 @@ func readText(filename string) []string {
}
func makePairs(words []string) [][]string {
pairs := make([][]string, len(words)-1)
var pairs [][]string
for i := 0; i < len(words)-1; i++ {
pairs[i] = append(words[i : i+2])
pairs = append(pairs, words[i:i+2])
}
return pairs
}
@ -32,14 +32,15 @@ func makePairs(words []string) [][]string {
func buildCFD(pairs [][]string) map[string]map[string]int {
CFD := make(map[string]map[string]int)
for i := range pairs {
word1 := pairs[i][0]
word2 := pairs[i][1]
_, key_exists := CFD[word1]
// a map returns two values: the 'value' in the key-value pair and a bool
// representing whether the key exists
_, wordexists := CFD[word1]
if key_exists {
if wordexists {
_, fd_exists := CFD[word1][word2]
if fd_exists {
@ -55,18 +56,18 @@ func buildCFD(pairs [][]string) map[string]map[string]int {
return CFD
}
func pickRandWord(probabilitySpread []string) string {
randomIndex := rand.Intn(len(probabilitySpread))
return probabilitySpread[randomIndex]
}
func generateText(CFD map[string]map[string]int, seedWord string) {
func generateText(CFD map[string]map[string]int) []string {
text := make([]string, 10)
// text[0] = seedWord
word1 := seedWord
word := "the"
for i := range text {
wordCFD := CFD[word1]
probabilitySpread := make([]string, 0)
wordCFD := CFD[word]
var probabilitySpread []string
for word2, freq := range wordCFD {
for j := 0; j <= freq; j++ {
probabilitySpread = append(probabilitySpread, word2)
@ -74,17 +75,18 @@ func generateText(CFD map[string]map[string]int, seedWord string) {
}
randword := pickRandWord(probabilitySpread)
text[i] = word1
word1 = randword
text[i] = word
word = randword
}
fmt.Print(text)
return text
}
func main() {
words := readText("./text.txt")
words := readFile("./deluze.txt")
pairs := makePairs(words)
CFD := buildCFD(pairs)
generateText(CFD, "the")
text := generateText(CFD)
fmt.Print(strings.Join(text, " "))
fmt.Print("\n")
}

View File

@ -1,2 +0,0 @@
What the fuck did you just fucking say about me, you little bitch? I'll have you know I graduated top of my class in the Navy Seals, and I've been involved in numerous secret raids on Al-Quaeda, and I have over 300 confirmed kills. I am trained in gorilla warfare and I'm the top sniper in the entire US armed forces. You are nothing to me but just another target. I will wipe you the fuck out with precision the likes of which has never been seen before on this Earth, mark my fucking words. You think you can get away with saying that shit to me over the Internet? Think again, fucker. As we speak I am contacting my secret network of spies across the USA and your IP is being traced right now so you better prepare for the storm, maggot. The storm that wipes out the pathetic little thing you call your life. You're fucking dead, kid. I can be anywhere, anytime, and I can kill you in over seven hundred ways, and that's just with my bare hands. Not only am I extensively trained in unarmed combat, but I have access to the entire arsenal of the United States Marine Corps and I will use it to its full extent to wipe your miserable ass off the face of the continent, you little shit. If only you could have known what unholy retribution your little "clever" comment was about to bring down upon you, maybe you would have held your fucking tongue. But you couldn't, you didn't, and now you're paying the price, you goddamn idiot. I will shit fury all over you and you will drown in it. You're fucking dead, kiddo.