当前位置: 首页>>代码示例>>C#>>正文


C# IStorage.Get方法代码示例

本文整理汇总了C#中IStorage.Get方法的典型用法代码示例。如果您正苦于以下问题:C# IStorage.Get方法的具体用法?C# IStorage.Get怎么用?C# IStorage.Get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IStorage的用法示例。


在下文中一共展示了IStorage.Get方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Permission

        public Permission(IStorage storage, String name, IBotGroup group)
        {
            _storage = storage;
            Name = name;
            Group = group;

            _allowed = _storage.Get<NullableRef<bool>>(Group.Name, Name, ALLOWED_QUALIFIER);
            _limit = _storage.Get<NullableRef<ushort>>(Group.Name, Name, LIMIT_QUALIFIER);
            _timespan = _storage.Get<NullableRef<TimeSpan>>(Group.Name, Name, TIMESPAN_QUALIFIER);
        }
开发者ID:Gohla,项目名称:Veda,代码行数:10,代码来源:Permission.cs

示例2: RetrieveScoresByUSStates

        public static Dictionary<string, float> RetrieveScoresByUSStates(IStorage storage, object filter = null)
        {
            IEnumerable<string> getAllTweets = storage.Get(filter);
            List<Dictionary<string, object>> tweetDicList = new List<Dictionary<string, object>>();
            Dictionary<string, List<string>> tweetsByState = new Dictionary<string, List<string>>();
            var lookupStateList = Utility.StateList();
            Dictionary<string, float> stateScores = new Dictionary<string, float>();

            foreach (var tweet in getAllTweets)
                tweetDicList.Add(GetTweetDictionary(tweet));

            foreach (var tweet in tweetDicList)
            {
                if (tweet.ContainsKey("user"))
                {
                    var userObject = tweet["user"];
                    if (userObject != null)
                    {
                        var user = JsonConvert.DeserializeObject<Dictionary<string, object>>(userObject.ToString());
                        if (user != null && user.ContainsKey("location"))
                        {
                            var locationObject = user["location"] as string;

                            if (!string.IsNullOrEmpty(locationObject))
                            {
                                string[] location = locationObject.Split(',');
                                var currentState = GetStateValue(location, lookupStateList);
                                if (!string.IsNullOrEmpty(currentState))
                                {
                                    if (!tweetsByState.ContainsKey(currentState))
                                        tweetsByState.Add(currentState, new List<string>());

                                    tweetsByState[currentState].Add(tweet["text"] as string);
                                }
                            }
                        }
                    }
                }
            }

            foreach (var state in tweetsByState.Where(t => t.Value.Any()))
            {
                float tweetScore = 0;
                foreach (var tweetList in state.Value)
                {
                    tweetScore += ScoreEachTweet(tweetList).Item2;
                }
                stateScores[state.Key] = tweetScore / state.Value.Count;

            }

            return stateScores;
        }
开发者ID:jsucupira,项目名称:Sentiment-Data-in-C-Sharp,代码行数:53,代码来源:ParseTwitterData.cs

示例3: Execute

 public void Execute(IStorage storage, String[] arguments)
 {
     var file = new FileStream(arguments[2], FileMode.Append);
     storage.Get(arguments[1], file);
 }
开发者ID:davidajulio,项目名称:claims,代码行数:5,代码来源:DriveClient.cs

示例4: RetrieveTweetsScores

        public static float RetrieveTweetsScores(IStorage storage, object filter = null)
        {
            IEnumerable<string> getAllTweets = storage.Get(filter);
            List<string> tweetList = new List<string>();

            foreach (var tweet in getAllTweets)
            {
                if (!string.IsNullOrEmpty(tweet))
                {
                    var item = ParseTweetText(tweet);
                    if (item != null && !string.IsNullOrEmpty(item))
                        tweetList.Add(item);
                }
            }

            float totalScore = 0;
            foreach (var socialData in tweetList)
            {
                totalScore += ScoreEachTweet(socialData).Item2;
            }
            return totalScore;
        }
开发者ID:jsucupira,项目名称:Sentiment-Data-in-C-Sharp,代码行数:22,代码来源:ParseTwitterData.cs

示例5: RetrieveTweetObjects

        public static List<SocialData> RetrieveTweetObjects(IStorage storage, string filter = null)
        {
            IEnumerable<string> getAllTweets = storage.Get(filter);

            List<SocialData> socialDataList = new List<SocialData>();
            foreach (var tweet in getAllTweets)
            {
                if (!string.IsNullOrEmpty(tweet))
                {
                    var item = ParceTweetsIntoObject(tweet);
                    if (item != null && !string.IsNullOrEmpty(item.Text))
                        socialDataList.Add(item);
                }
            }
            return socialDataList;
        }
开发者ID:jsucupira,项目名称:Sentiment-Data-in-C-Sharp,代码行数:16,代码来源:ParseTwitterData.cs

示例6: RetrieveTermSentiments

        public static Dictionary<string, float> RetrieveTermSentiments(IStorage storage, object filter = null)
        {
            IEnumerable<string> getAllTweets = storage.Get(filter);
            List<string> tweetList = new List<string>();

            foreach (var tweet in getAllTweets)
            {
                if (!string.IsNullOrEmpty(tweet) && !string.IsNullOrWhiteSpace(tweet))
                {
                    var item = ParseTweetText(tweet);
                    if (item != null && !string.IsNullOrEmpty(item))
                        tweetList.Add(item);
                }
            }

            Dictionary<string, float> nonSentiments = new Dictionary<string, float>(tweetList.Count);
            Dictionary<string, float> termsAndScores = new Dictionary<string, float>(tweetList.Count);
            Dictionary<string, float> totalAppearance = new Dictionary<string, float>(tweetList.Count);

            foreach (var socialData in tweetList)
            {
                float tweetScore = 0;
                tweetScore += ScoreEachTweet(socialData).Item2;

                var tweetWords = socialData.Split(' ');
                foreach (var word in tweetWords)
                {
                    if (!string.IsNullOrWhiteSpace(word) && !string.IsNullOrWhiteSpace(word))
                    {
                        string wordToLower = word.ToLower();
                        if (!_scoreDictionary.ContainsKey(wordToLower))
                        {
                            if (nonSentiments.ContainsKey(wordToLower))
                            {
                                nonSentiments[wordToLower] += tweetScore;
                                totalAppearance[wordToLower]++;
                            }
                            else
                            {
                                nonSentiments.Add(wordToLower, tweetScore);
                                totalAppearance.Add(wordToLower, 1);
                            }
                        }
                    }
                }
            }

            foreach (var nonSentiment in nonSentiments)
            {
                termsAndScores.Add(nonSentiment.Key, (nonSentiment.Value / totalAppearance[nonSentiment.Key]));
            }
            return termsAndScores;
        }
开发者ID:jsucupira,项目名称:Sentiment-Data-in-C-Sharp,代码行数:53,代码来源:ParseTwitterData.cs


注:本文中的IStorage.Get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。