|
@@ -0,0 +1,105 @@
|
|
|
|
+--用户唯一标识
|
|
|
|
+appid="jyFhJXQgMAAwZfQUNKDzx6"
|
|
|
|
+--匹配词
|
|
|
|
+keys1={
|
|
|
|
+ {"政务云","不动产登记","涉密网","机要网","质量监督管理局","政法网","电子政务","警务云"},
|
|
|
|
+ {"三通两平台","云学堂","云课堂","云教室","薄改","改薄","校园网","教育云"},
|
|
|
|
+ {"卫生云","卫生信息平台","医疗卫生机构管理信息系统","医疗机构管理信息系统","工业4.0","智能制造","全民健康","中医馆","MES","HIS","HANA","高性能计算"},
|
|
|
|
+ {"交通一卡通","两网融合","智慧交通","智慧高速","智慧公交"}
|
|
|
|
+}
|
|
|
|
+keys1_1={"政府","教育","企业","公共事业"}
|
|
|
|
+keys2={"交换机","路由器","防火墙","网络安全","负载均衡","服务器","存储","小机","小型机","无线网","大数据","云计算","云平台","等保","等级保护","物联网"}
|
|
|
|
+--排除词
|
|
|
|
+notkey1={"监理","设计","施工","装修","维修","维护","维保","运维","打印","扫描","投影","数据整合","缆","土建","空调","电脑"}
|
|
|
|
+notkey2={"软件","办公","服务"}
|
|
|
|
+notkey2_2={{"数据中心","平台","网络"},{"办公网"},{"服务器","硬件集成","云平台建设","网络"}}
|
|
|
|
+--脚本主入口方法
|
|
|
|
+function filterValidate(data)
|
|
|
|
+ --匹配上的父节点,对应的子节点,是否成功
|
|
|
|
+ local y_p,y_k,y_ok = "","",false
|
|
|
|
+ --标题处理
|
|
|
|
+ local title = data["title"]
|
|
|
|
+ --print(title)
|
|
|
|
+ if title ~= nil and title ~= "" then
|
|
|
|
+ --标题匹配
|
|
|
|
+ y_p,y_k,y_ok = match(title)
|
|
|
|
+ --print("title包含--",y_p,y_k,y_ok)
|
|
|
|
+ --如果标题匹配上,进行标题排除
|
|
|
|
+ if y_ok then
|
|
|
|
+ --排除匹配上的词,对应的保留词,是否成功
|
|
|
|
+ local n_p,n_k,n_ok = exclude(title)
|
|
|
|
+ if n_p ~= "" and n_k ~= "" then
|
|
|
|
+ --print("title排除--","排除",n_p,",保留",n_k,",",n_ok)
|
|
|
|
+ else
|
|
|
|
+ --print("title排除--",n_p,n_k,n_ok)
|
|
|
|
+ end
|
|
|
|
+ if n_ok then
|
|
|
|
+ return nil
|
|
|
|
+ end
|
|
|
|
+ end
|
|
|
|
+ end
|
|
|
|
+ --正文处理
|
|
|
|
+ local detail = data["detail"]
|
|
|
|
+ --print(detail)
|
|
|
|
+ if detail ~= nil and detail ~= "" then
|
|
|
|
+ --如果标题没有匹配上,匹配正文
|
|
|
|
+ if not y_ok then
|
|
|
|
+ --排除匹配上的词,对应的保留词,是否成功
|
|
|
|
+ y_p,y_k,y_ok = match(detail)
|
|
|
|
+ --print("detail包含--",y_p,y_k,y_ok)
|
|
|
|
+ end
|
|
|
|
+ --匹配上标题或者正文,都要进行正文排除
|
|
|
|
+ --排除匹配上的词,对应的保留词,是否成功
|
|
|
|
+ if y_ok then
|
|
|
|
+ local n_p,n_k,n_ok = exclude(detail)
|
|
|
|
+ if n_p ~= "" and n_k ~= "" then
|
|
|
|
+ --print("detail排除--","排除",n_p,",保留",n_k,",",n_ok)
|
|
|
|
+ else
|
|
|
|
+ --print("detail排除--",n_p,n_k,n_ok)
|
|
|
|
+ end
|
|
|
|
+ if n_ok then
|
|
|
|
+ return nil
|
|
|
|
+ end
|
|
|
|
+ end
|
|
|
|
+ end
|
|
|
|
+ --没有匹配上
|
|
|
|
+ if not y_ok then
|
|
|
|
+ return nil
|
|
|
|
+ end
|
|
|
|
+ return data
|
|
|
|
+end
|
|
|
|
+--包含
|
|
|
|
+function match(value)
|
|
|
|
+ for k,keys in pairs(keys1) do
|
|
|
|
+ for i,key in pairs(keys) do
|
|
|
|
+ if string.find(value,key) ~= nil then
|
|
|
|
+ return keys1_1[k],key,true
|
|
|
|
+ end
|
|
|
|
+ end
|
|
|
|
+ end
|
|
|
|
+ for k,key in pairs(keys2) do
|
|
|
|
+ if string.find(value,key) ~= nil then
|
|
|
|
+ return "",key,true
|
|
|
|
+ end
|
|
|
|
+ end
|
|
|
|
+ return "","",false
|
|
|
|
+end
|
|
|
|
+--排除
|
|
|
|
+function exclude(value)
|
|
|
|
+ for k,key in pairs(notkey1) do
|
|
|
|
+ if string.find(value,key) ~= nil then
|
|
|
|
+ return key,"",true
|
|
|
|
+ end
|
|
|
|
+ end
|
|
|
|
+ for k,key in pairs(notkey2) do
|
|
|
|
+ if string.find(value,key) ~= nil then
|
|
|
|
+ for i,n in pairs(notkey2_2[k]) do
|
|
|
|
+ if string.find(value,n) ~= nil then
|
|
|
|
+ return key,n,false
|
|
|
|
+ end
|
|
|
|
+ end
|
|
|
|
+ return key,"",true
|
|
|
|
+ end
|
|
|
|
+ end
|
|
|
|
+ return "","",false
|
|
|
|
+end
|