argos/analyzeSource.go
analyzeSource.goRaw
1package main
2
3import (
4 "strings"
5
6 "github.com/dghubble/go-twitter/twitter"
7)
8
9func analyzeSource(tweets []twitter.Tweet) map[string]int {
10 var sources = make(map[string]int)
11 for _, v := range tweets {
12 source := strings.Split(strings.Split(v.Source, ">")[1], "<")[0]
13 if _, ok := sources[source]; ok {
14 sources[source] = sources[source] + 1
15 } else {
16 sources[source] = 1
17 }
18 }
19 return (sources)
20}