minimal changes and readme update

This commit is contained in:
arnaucode
2017-04-22 22:23:33 +02:00
parent 13e26f1c71
commit 592f97ec63
5 changed files with 9 additions and 4 deletions

View File

@@ -8,3 +8,7 @@ generatedText := markov.generateText(states, firstWord, count)
fmt.Println(generatedText)
```
(in the text variable, goes the text content, can be loaded from a .txt file)
![Argos](https://raw.githubusercontent.com/arnaucode/goMarkov/master/goMarkov.gif "goMarkov")

BIN
build/goMarkov Executable file

Binary file not shown.

BIN
goMarkov.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 480 KiB

View File

@@ -45,5 +45,6 @@ func main() {
fmt.Println("generating text")
generatedText := markov.generateText(states, firstWord, count)
fmt.Println("")
fmt.Println(generatedText)
fmt.Println("generated text")
fmt.Println("\x1b[32;1m" + generatedText + "\x1b[0m")
}

View File

@@ -26,7 +26,7 @@ func printLoading(n int, total int) {
bar = append(bar, "█")
}
progressBar := strings.Join(bar, "")
fmt.Printf("\r " + progressBar + " - " + strconv.Itoa(tantPerCent) + "%")
fmt.Printf("\r " + progressBar + " - " + strconv.Itoa(tantPerCent) + "")
}
func addWordToStates(states []State, word string) ([]State, int) {
@@ -70,7 +70,7 @@ func calcMarkovStates(words []string) []State {
states[i].NextStates[j].Prob = (float64(states[i].NextStates[j].Count) / float64(len(words)) * 100)
}
}
fmt.Println("total words computed: " + strconv.Itoa(len(words)))
fmt.Println("\ntotal words computed: " + strconv.Itoa(len(words)))
//fmt.Println(states)
return states
}
@@ -118,7 +118,7 @@ func (markov Markov) generateText(states []State, initWord string, count int) st
word = getNextMarkovState(states, word)
generatedText = append(generatedText, word)
}
generatedText = append(generatedText, ".")
//generatedText = append(generatedText, ".")
text := strings.Join(generatedText, " ")
return text
}