本文整理匯總了Python中region.Region.getKey方法的典型用法代碼示例。如果您正苦於以下問題:Python Region.getKey方法的具體用法?Python Region.getKey怎麽用?Python Region.getKey使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類region.Region
的用法示例。
在下文中一共展示了Region.getKey方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: generateData2
# 需要導入模塊: from region import Region [as 別名]
# 或者: from region.Region import getKey [as 別名]
def generateData2():
# if sparse:
#rep = Representor()
all_corpus = buildAllCorpus(time_interval_length=14, debug=True)
true_event_list, false_event_list = loadUnbalancedData()
BaseFeatureProduction.GenerateArffFileHeader()
for event in true_event_list + false_event_list:
r = Region(event['region'])
corpus = all_corpus[r.getKey()]
BaseFeatureProduction(event, corpus, None).printFeatures()
示例2: testWithTweet
# 需要導入模塊: from region import Region [as 別名]
# 或者: from region.Region import getKey [as 別名]
def testWithTweet():
cnt = 0
corpus_all = buildAllCorpus(element_type='tweets', debug=False)
ei = EventInterface()
ei.setDB('citybeat_experiment')
ei.setCollection('twitter_candidate_events')
cur = ei.getAllDocuments()
print TwitterFeature.GenerateArffFileHeader()
for event in cur:
region = Region(event['region'])
event = TwitterFeature(event, corpus=corpus_all[region.getKey()])
if event.getActualValue() < 8:
print '< 8'
continue
cnt += 1
print event.extractFeatures()
print cnt, cur.count()
示例3: _getEventWordCorpus
# 需要導入模塊: from region import Region [as 別名]
# 或者: from region.Region import getKey [as 別名]
def _getEventWordCorpus(self, event):
region = Region(Event(event).toDict()["region"])
return self._corpus_dicts_word[region.getKey()]
示例4: _getEventCharCorpus
# 需要導入模塊: from region import Region [as 別名]
# 或者: from region.Region import getKey [as 別名]
def _getEventCharCorpus(self, event):
region = Region(Event(event).toDict()["region"])
return self._corpus_dicts_char[region.getKey()]