mirror of
https://github.com/arnaucube/argos.git
synced 2026-02-07 02:56:41 +01:00
improved words analysis, punctuation symbols filtered
This commit is contained in:
@@ -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
build/argos
BIN
build/argos
Binary file not shown.
Reference in New Issue
Block a user