本文整理匯總了Python中Filter.Filter.apply方法的典型用法代碼示例。如果您正苦於以下問題:Python Filter.apply方法的具體用法?Python Filter.apply怎麽用?Python Filter.apply使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Filter.Filter
的用法示例。
在下文中一共展示了Filter.apply方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: main
# 需要導入模塊: from Filter import Filter [as 別名]
# 或者: from Filter.Filter import apply [as 別名]
def main():
HOME_PATH = "D:\\SENTIFI_DATA\\filter\\"
FILE_PATH_TO_JSON_MESSAGES = HOME_PATH + "messages.json"
FILE_PATH_TO_JSON_CRITERIA = HOME_PATH + "criteria.json"
json_messages = IOUtils().read_json_data_from_file(FILE_PATH_TO_JSON_MESSAGES)
json_criteria = IOUtils().read_json_data_from_file(FILE_PATH_TO_JSON_CRITERIA)
list_criteria = []
for criteria in json_criteria:
item = SentifiSearchItem(criteria)
list_criteria.append(item)
list_messages = []
for json_item in json_messages:
message = SentifiMessage(json_item)
list_messages.append(message)
#For each message, compare its soid to criteria's soid
for message in list_messages:
for criteria in list_criteria:
if message.soid == criteria.soid:
filter = Filter(message, criteria)
filter.apply()
for msg in list_messages:
message.display()
return list_messages