Exemplo n.º 1
0
        public static void GetFeed(string tweetFilePath, SortedDictionary <string, List <string> > users)
        {
            var userTweets = new List <Tuple <string, string> >();
            //

            const string bracket = "> ";

            foreach (var line in FileReadWorker.ReadFile(tweetFilePath))
            {
                var userIndex = line.IndexOf(bracket);
                var user      = line.Substring(0, userIndex);
                var tweet     = line.Substring(user.Length + bracket.Length, line.Length - user.Length - bracket.Length);

                userTweets.Add(Tuple.Create(user, tweet));
            }
            BuildUserFeeds(users, userTweets);
        }
Exemplo n.º 2
0
        public static SortedDictionary <string, List <string> > GetUsers(string userFilePath)
        {
            var userDictionary = new SortedDictionary <string, List <string> >();

            const string follows = " follows ";

            foreach (var line in FileReadWorker.ReadFile(userFilePath))
            {
                var followerIndex = line.IndexOf(follows, 0);
                var follower      = line.Substring(0, followerIndex);

                var users = line.Substring(followerIndex + follows.Length, line.Length - followerIndex - follows.Length);

                var userList = users.Split(',');
                BuildUserRelationship(userDictionary, follower, userList);
            }

            return(userDictionary);
        }