|
@ -26,7 +26,7 @@ func printLoading(n int, total int) { |
|
|
bar = append(bar, "█") |
|
|
bar = append(bar, "█") |
|
|
} |
|
|
} |
|
|
progressBar := strings.Join(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) { |
|
|
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) |
|
|
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)
|
|
|
//fmt.Println(states)
|
|
|
return states |
|
|
return states |
|
|
} |
|
|
} |
|
@ -118,7 +118,7 @@ func (markov Markov) generateText(states []State, initWord string, count int) st |
|
|
word = getNextMarkovState(states, word) |
|
|
word = getNextMarkovState(states, word) |
|
|
generatedText = append(generatedText, word) |
|
|
generatedText = append(generatedText, word) |
|
|
} |
|
|
} |
|
|
generatedText = append(generatedText, ".") |
|
|
|
|
|
|
|
|
//generatedText = append(generatedText, ".")
|
|
|
text := strings.Join(generatedText, " ") |
|
|
text := strings.Join(generatedText, " ") |
|
|
return text |
|
|
return text |
|
|
} |
|
|
} |