本文整理汇总了C++中Topic::GetTopicWeiboId方法的典型用法代码示例。如果您正苦于以下问题:C++ Topic::GetTopicWeiboId方法的具体用法?C++ Topic::GetTopicWeiboId怎么用?C++ Topic::GetTopicWeiboId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Topic
的用法示例。
在下文中一共展示了Topic::GetTopicWeiboId方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ListEveryTopicWeiboId
void Cluster::ListEveryTopicWeiboId(Topic &one_topic) {
list<TopicWord>::iterator topic_it = one_topic.GetsTopic()->begin();
std::map<std::string, double> *topic_weibo_id_map =one_topic.GetTopicWeiboId();
std::map<std::string, double>::iterator topic_weibo_id_map_it;
one_topic.topic_message_num = 0;
for (; topic_it != one_topic.GetsTopic()->end(); ++topic_it) {
std::set<std::string>::iterator topicword_weibolist_it =
topic_it->GetWordToWeiboidList()->begin();
for (; topicword_weibolist_it
!= topic_it->GetWordToWeiboidList()->end(); ++topicword_weibolist_it) {
std::string weiboid = *topicword_weibolist_it;
topic_weibo_id_map_it = topic_weibo_id_map->find(weiboid);
if (topic_weibo_id_map_it != topic_weibo_id_map->end()) {
topic_weibo_id_map_it->second = topic_weibo_id_map_it->second + 1;
} else {
topic_weibo_id_map->insert(make_pair(weiboid, 1.0));
}
}
}
topic_weibo_id_map_it = topic_weibo_id_map->begin();
for (; topic_weibo_id_map_it != topic_weibo_id_map->end(); ++topic_weibo_id_map_it) {
if (topic_weibo_id_map_it->second >= this->BELONG_TOPIC_THROD) {
subword sw(topic_weibo_id_map_it->first,topic_weibo_id_map_it->second);
one_topic.GetWeiboIdList()->push_back(sw);
one_topic.topic_message_num += 1;
}
}
one_topic.GetTopicWeiboId()->clear();
std::sort(one_topic.GetWeiboIdList()->begin(),
one_topic.GetWeiboIdList()->end(), weibosort);
//及时清除内存
if(one_topic.topic_message_num<=this->MIN_TOPIC_MESSAGE_NUM) {
one_topic.weibo_id_list.clear();
std::vector<subword>(one_topic.weibo_id_list).swap(one_topic.weibo_id_list);
}
//将得出的结果存进数据库
}