improved words analysis, punctuation symbols filtered

This commit is contained in:
arnaucode
2017-06-06 21:30:44 +02:00
parent 4beff6fbd0
commit 789235bcbb
4 changed files with 9 additions and 1 deletions

View File

@@ -11,7 +11,15 @@ func mapWords(text string, words map[string]int) map[string]int {
s := strings.Split(text, " ") s := strings.Split(text, " ")
for _, v := range s { for _, v := range s {
//first, remove punctuation symbols
v = strings.Replace(v, ":", "", -1)
v = strings.Replace(v, ",", "", -1)
v = strings.Replace(v, ".", "", -1)
v = strings.Replace(v, "!", "", -1)
v = strings.Replace(v, "?", "", -1)
v = strings.Replace(v, "\n", "", -1)
if _, ok := words[v]; ok { if _, ok := words[v]; ok {
fmt.Println(v)
words[v] = words[v] + 1 words[v] = words[v] + 1
} else { } else {
words[v] = 1 words[v] = 1

BIN
argos

Binary file not shown.

Binary file not shown.

View File

@@ -7,7 +7,7 @@ import (
"strings" "strings"
) )
const version = "0.2-beta" const version = "0.3-beta"
const minNumWords = 10 const minNumWords = 10
const minNumHashtag = 2 const minNumHashtag = 2
const minNumUserInteractions = 1 const minNumUserInteractions = 1