本文整理汇总了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);
}
示例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;
}
示例3: Execute
public void Execute(IStorage storage, String[] arguments)
{
var file = new FileStream(arguments[2], FileMode.Append);
storage.Get(arguments[1], file);
}
示例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;
}
示例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;
}
示例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;
}