本文整理汇总了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