OxbridgeEconomics
commited on
Commit
·
d860eae
1
Parent(s):
36b7b27
commit
Browse files- patterns.json +404 -378
- utils.py +61 -35
patterns.json
CHANGED
@@ -1,380 +1,406 @@
|
|
1 |
[
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
380 |
]
|
|
|
1 |
[
|
2 |
+
{
|
3 |
+
"site": "China Development Bank Securities Co., Ltd.",
|
4 |
+
"pages": [0],
|
5 |
+
"date_range": 1,
|
6 |
+
"keyword": "相关报告",
|
7 |
+
"article_regex": "《(.*?)》",
|
8 |
+
"no_date": 1,
|
9 |
+
"date_regex": "(\\d{4}-\\d{2}-\\d{2})",
|
10 |
+
"date_format": "%Y-%m-%d",
|
11 |
+
"split":[
|
12 |
+
{
|
13 |
+
"string": "—",
|
14 |
+
"index": -1
|
15 |
+
}
|
16 |
+
]
|
17 |
+
},
|
18 |
+
{
|
19 |
+
"site": "Donghai Securities Co., Ltd.",
|
20 |
+
"pages": [0],
|
21 |
+
"date_range": 1,
|
22 |
+
"keyword": "相关研究",
|
23 |
+
"article_regex": "《(.*?)》",
|
24 |
+
"no_date": 1,
|
25 |
+
"date_regex": "(\\d{4}-\\d{2}-\\d{2})",
|
26 |
+
"date_format": "%Y-%m-%d"
|
27 |
+
},
|
28 |
+
{
|
29 |
+
"site": "Guosen Securities Co., Ltd.",
|
30 |
+
"pages": [0],
|
31 |
+
"date_range": 1,
|
32 |
+
"keyword": "相关研究报告",
|
33 |
+
"article_regex": "《(.*?)》",
|
34 |
+
"date_regex": "(\\d{4}-\\d{2}-\\d{2})",
|
35 |
+
"date_format": "%Y-%m-%d",
|
36 |
+
"split":[
|
37 |
+
{
|
38 |
+
"string": "-",
|
39 |
+
"index": -1
|
40 |
+
}
|
41 |
+
]
|
42 |
+
},
|
43 |
+
{
|
44 |
+
"site": "Soochow Securities Co., Ltd.",
|
45 |
+
"pages": [0],
|
46 |
+
"date_range": 2,
|
47 |
+
"keyword": "相关研究",
|
48 |
+
"article_regex": "《(.*?)》",
|
49 |
+
"date_regex": "\\b\\d{4}-\\d{2}-\\d{2}|\\d{4} -\\d{2}-\\d{2}\\b",
|
50 |
+
"date_format": "%Y-%m-%d",
|
51 |
+
"split":[
|
52 |
+
{
|
53 |
+
"string": "-",
|
54 |
+
"index": 0
|
55 |
+
},
|
56 |
+
{
|
57 |
+
"string": "—",
|
58 |
+
"index": 0
|
59 |
+
}
|
60 |
+
]
|
61 |
+
},
|
62 |
+
{
|
63 |
+
"site": "BOCI Securities Co., Ltd.",
|
64 |
+
"pages": [0],
|
65 |
+
"date_range": 1,
|
66 |
+
"keyword": "相关研究报告",
|
67 |
+
"article_regex": "《(.*?)》",
|
68 |
+
"date_regex": "20\\d{6}|20\\d{5}\\s{1}\\d{1}",
|
69 |
+
"date_format": "%Y%m%d"
|
70 |
+
},
|
71 |
+
{
|
72 |
+
"site": "Tianfeng Securities Co., Ltd.",
|
73 |
+
"pages": [0],
|
74 |
+
"date_range": 3,
|
75 |
+
"keyword": "相关报告",
|
76 |
+
"article_regex": " 《(.*?)》",
|
77 |
+
"date_regex": "\\b\\d{4}-\\d{2}-\\d{2}|\\d{4} -\\d{2}-\\d{2}\\b",
|
78 |
+
"date_format": "%Y-%m-%d",
|
79 |
+
"remove": ["宏观报告:", "宏观-", "宏观报告-", "——"],
|
80 |
+
"split":[
|
81 |
+
{
|
82 |
+
"string": ":",
|
83 |
+
"index": 1
|
84 |
+
},
|
85 |
+
{
|
86 |
+
"string": "-",
|
87 |
+
"index": 0
|
88 |
+
},
|
89 |
+
{
|
90 |
+
"string": "(",
|
91 |
+
"index": 1
|
92 |
+
}
|
93 |
+
]
|
94 |
+
},
|
95 |
+
{
|
96 |
+
"site": "Kaiyuan Securities Co., Ltd.",
|
97 |
+
"pages": [0],
|
98 |
+
"date_range": 1,
|
99 |
+
"keyword": " ",
|
100 |
+
"article_regex": " 《(.*?)》",
|
101 |
+
"date_regex": "\\b\\d{4}\\.\\d{1,2}\\.\\d{1,2}\\b",
|
102 |
+
"date_format": "%Y.%m.%d",
|
103 |
+
"split":[
|
104 |
+
{
|
105 |
+
"string": "—",
|
106 |
+
"index": 1
|
107 |
+
}
|
108 |
+
]
|
109 |
+
},
|
110 |
+
{
|
111 |
+
"site": "Huafu Securities Co., Ltd.",
|
112 |
+
"pages": [0],
|
113 |
+
"date_range": 4,
|
114 |
+
"keyword": "相关报告",
|
115 |
+
"article_regex": "《(.*?)》",
|
116 |
+
"date_regex": "20\\d{2}\\s?\\.\\s?\\d{1}\\s?\\d{1}\\s?\\.\\s?\\d{1,2}",
|
117 |
+
"date_format": "%Y.%m.%d",
|
118 |
+
"split":[
|
119 |
+
{
|
120 |
+
"string": ":",
|
121 |
+
"index": 1
|
122 |
+
},
|
123 |
+
{
|
124 |
+
"string": "——",
|
125 |
+
"index": 0
|
126 |
+
}
|
127 |
+
]
|
128 |
+
},
|
129 |
+
{
|
130 |
+
"site": "Minsheng Securities Co., Ltd.",
|
131 |
+
"pages": [0],
|
132 |
+
"date_range": 1,
|
133 |
+
"keyword": "相关研究",
|
134 |
+
"article_regex": "\\.(.*?)\\-",
|
135 |
+
"date_regex": "20\\d{2}\\/\\d{2}\\/\\d{2}",
|
136 |
+
"date_format": "%Y/%m/%d",
|
137 |
+
"split":[
|
138 |
+
{
|
139 |
+
"string": ":",
|
140 |
+
"index": 1
|
141 |
+
}
|
142 |
+
]
|
143 |
+
},
|
144 |
+
{
|
145 |
+
"site": "Guolian Securities Co., Ltd.",
|
146 |
+
"pages": [0],
|
147 |
+
"date_range": 1,
|
148 |
+
"keyword": "相关报告 ",
|
149 |
+
"article_regex": "《(.*?)》",
|
150 |
+
"date_regex": "[》 ]20\\d{2}\\.\\d{2}\\.\\d{2}",
|
151 |
+
"date_format": "%Y.%m.%d",
|
152 |
+
"split":[
|
153 |
+
{
|
154 |
+
"string": ":",
|
155 |
+
"index": 0
|
156 |
+
}
|
157 |
+
]
|
158 |
+
},
|
159 |
+
{
|
160 |
+
"site": "Southwest Securities Co., Ltd.",
|
161 |
+
"pages": [0],
|
162 |
+
"date_range": 1,
|
163 |
+
"keyword": "相关研究",
|
164 |
+
"article_regex": "\\.(.*?)\\(",
|
165 |
+
"date_regex": "(20\\d{2}\\s?-\\d{2}\\-\\d{2})",
|
166 |
+
"date_format": "%Y-%m-%d"
|
167 |
+
},
|
168 |
+
{
|
169 |
+
"site": "Guangdong Securities Co., Ltd.",
|
170 |
+
"pages": [0],
|
171 |
+
"date_range": 1,
|
172 |
+
"keyword": "近期报告",
|
173 |
+
"article_regex": "《(.*?)》",
|
174 |
+
"date_regex": "20\\d{2}\\s?-\\d{2}\\-\\d{2}",
|
175 |
+
"date_format": "%Y-%m-%d"
|
176 |
+
},
|
177 |
+
{
|
178 |
+
"site": "China Post Securities Co., Ltd.",
|
179 |
+
"pages": [0],
|
180 |
+
"date_range": 1,
|
181 |
+
"keyword": "近期研究报告",
|
182 |
+
"article_regex": "《(.*?)》",
|
183 |
+
"date_regex": "20\\d{2}\\s?.\\d{2}\\.\\d{2}",
|
184 |
+
"date_format": "%Y.%m.%d",
|
185 |
+
"split":[
|
186 |
+
{
|
187 |
+
"string": "-",
|
188 |
+
"index": 1
|
189 |
+
},
|
190 |
+
{
|
191 |
+
"string": "——",
|
192 |
+
"index": 0
|
193 |
+
}
|
194 |
+
]
|
195 |
+
},
|
196 |
+
{
|
197 |
+
"site": "Shanxi Securities Co., Ltd.",
|
198 |
+
"pages": [0],
|
199 |
+
"date_range": 1,
|
200 |
+
"keyword": " ",
|
201 |
+
"article_regex": "】(.*?)\\(",
|
202 |
+
"date_regex": "20\\d{2}\\s?.\\s?\\d{1,2}\\s?.\\s?\\d{1,2} ",
|
203 |
+
"date_format": "%Y.%m.%d"
|
204 |
+
},
|
205 |
+
{
|
206 |
+
"site": "Shanghai Securities Co., Ltd.",
|
207 |
+
"pages": [0],
|
208 |
+
"date_range": 1,
|
209 |
+
"keyword": "Table_Rep",
|
210 |
+
"article_regex": "《(.*?)》",
|
211 |
+
"date_regex": "20\\d{2}年\\d{2}月\\d{2}",
|
212 |
+
"date_format": "%Y年%m月%d"
|
213 |
+
},
|
214 |
+
{
|
215 |
+
"site": "Guoyuan Securities Co., Ltd.",
|
216 |
+
"pages": [0],
|
217 |
+
"date_range": 2,
|
218 |
+
"keyword": "[Table_Report]",
|
219 |
+
"article_regex": "《(.*?)》 ",
|
220 |
+
"date_regex": " 20\\d{2}.\\d{2}.\\d{2} ",
|
221 |
+
"date_format": "%Y.%m.%d",
|
222 |
+
"split":[
|
223 |
+
{
|
224 |
+
"string": ":",
|
225 |
+
"index": 0
|
226 |
+
}
|
227 |
+
]
|
228 |
+
},
|
229 |
+
{
|
230 |
+
"site": "Mago Securities Co., Ltd.",
|
231 |
+
"pages": [0],
|
232 |
+
"date_range": 1,
|
233 |
+
"keyword": "相关研究",
|
234 |
+
"article_regex": "《(.*?)》",
|
235 |
+
"date_regex": "20\\d{2}\\s?.\\s?\\d{2}\\s?.\\s?\\d{2} ",
|
236 |
+
"date_format": "%Y.%m.%d",
|
237 |
+
"split":[
|
238 |
+
{
|
239 |
+
"string": "(",
|
240 |
+
"index": 0
|
241 |
+
}
|
242 |
+
]
|
243 |
+
},
|
244 |
+
{
|
245 |
+
"site": "Fed Securities, Inc.",
|
246 |
+
"pages": [0],
|
247 |
+
"date_range": 3,
|
248 |
+
"keyword": "相关报告",
|
249 |
+
"article_regex": ":(.*?)20",
|
250 |
+
"date_regex": "20\\d{2}\\s?.\\s?\\d{2}\\s?.\\s?\\d{2}",
|
251 |
+
"date_format": "%Y.%m.%d"
|
252 |
+
},
|
253 |
+
{
|
254 |
+
"site": "Huabao Securities Co., Ltd.",
|
255 |
+
"pages": [0],
|
256 |
+
"date_range": 1,
|
257 |
+
"keyword": "相关研究报告",
|
258 |
+
"article_regex": "《(.*?)》",
|
259 |
+
"date_regex": "(\\d{4}-\\d{2}-\\d{2})",
|
260 |
+
"date_format": "%Y-%m-%d"
|
261 |
+
},
|
262 |
+
{
|
263 |
+
"site": "Ruitingdog (Shenzhen) Information Technology Co., Ltd.",
|
264 |
+
"pages": [0],
|
265 |
+
"date_range": 1,
|
266 |
+
"keyword": "近期研究",
|
267 |
+
"article_regex": ":(.*?)-",
|
268 |
+
"date_regex": "\\d{4}\\s?/\\s?\\d{1,2}\\s?/\\s?\\d{1,2}",
|
269 |
+
"date_format": "%Y/%m/%d"
|
270 |
+
},
|
271 |
+
{
|
272 |
+
"site": "Oriental Fortune Securities Co., Ltd.",
|
273 |
+
"pages": [0],
|
274 |
+
"date_range": 1,
|
275 |
+
"keyword": "相关研究",
|
276 |
+
"article_regex": "《(.*?)》",
|
277 |
+
"date_regex": "\\d{4}\\s?.\\s?\\d{1,2}\\s?.\\s?\\d{1,2}",
|
278 |
+
"date_format": "%Y.%m.%d"
|
279 |
+
},
|
280 |
+
{
|
281 |
+
"site": "Yongxing Securities Co., Ltd.",
|
282 |
+
"pages": [0],
|
283 |
+
"date_range": 1,
|
284 |
+
"keyword": "相关报告:",
|
285 |
+
"article_regex": "《(.*?)》",
|
286 |
+
"date_regex": "—— \\d{4}\\s?年\\s?\\d{1,2}\\s?月\\s?\\d{1,2}",
|
287 |
+
"date_format": "——%Y年%m月%d"
|
288 |
+
},
|
289 |
+
{
|
290 |
+
"site": "Minmetals Securities Co., Ltd.",
|
291 |
+
"pages": [0],
|
292 |
+
"date_range": 1,
|
293 |
+
"keyword": "相关研究",
|
294 |
+
"article_regex": "《(.*?)》",
|
295 |
+
"date_regex": "(d{4}\\s/\\d{2}/\\d{2}) ",
|
296 |
+
"date_format": "(%Y/%m/%d) "
|
297 |
+
},
|
298 |
+
{
|
299 |
+
"site": "Hualong Securities Co., Ltd.",
|
300 |
+
"pages": [0],
|
301 |
+
"date_range": 1,
|
302 |
+
"keyword": "相关阅读",
|
303 |
+
"article_regex": "《(.*?)》",
|
304 |
+
"date_regex": "\\d{4}\\s?.\\s?\\d{1,2}\\s?.\\s?\\d{1,2}",
|
305 |
+
"date_format": "%Y.%m.%d"
|
306 |
+
},
|
307 |
+
{
|
308 |
+
"site": "Hebei Yuanda Information Technology Co., Ltd.",
|
309 |
+
"pages": [0],
|
310 |
+
"date_range": 1,
|
311 |
+
"keyword": "相关报告:",
|
312 |
+
"article_regex": "《(.*?)》",
|
313 |
+
"date_regex": "\\d{4}\\s?.\\s?\\d{1,2}\\s?.\\s?\\d{1,2}",
|
314 |
+
"date_format": "%Y.%m.%d"
|
315 |
+
},
|
316 |
+
{
|
317 |
+
"site": "Huaxin Securities Co., Ltd.",
|
318 |
+
"pages": [0],
|
319 |
+
"date_range": 1,
|
320 |
+
"keyword": "相关研究",
|
321 |
+
"article_regex": "《(.*?)》",
|
322 |
+
"date_regex": "(\\d{4}-\\d{2}-\\d{2})",
|
323 |
+
"date_format": "%Y-%m-%d"
|
324 |
+
},
|
325 |
+
{
|
326 |
+
"site": "Far East Credit Rating Co., Ltd.",
|
327 |
+
"pages": [0],
|
328 |
+
"date_range": 1,
|
329 |
+
"keyword": "1.",
|
330 |
+
"article_regex": "《(.*?)》",
|
331 |
+
"date_regex": "\\d{4}\\s?.\\s?\\d{1,2}\\s?.\\s?\\d{1,2}",
|
332 |
+
"date_format": "%Y.%m.%d"
|
333 |
+
},
|
334 |
+
{
|
335 |
+
"site": "Beijing Tengjing Big Data Application Technology Research Institute",
|
336 |
+
"pages": [0],
|
337 |
+
"date_range": 1,
|
338 |
+
"keyword": "相关报告",
|
339 |
+
"article_regex": "《(.*?)》",
|
340 |
+
"date_regex": "(\\d{4}-\\d{2}-\\d{2})",
|
341 |
+
"date_format": "%Y-%m-%d"
|
342 |
+
},
|
343 |
+
{
|
344 |
+
"site": "Wanhe Securities Co., Ltd.",
|
345 |
+
"pages": [0],
|
346 |
+
"date_range": 1,
|
347 |
+
"keyword": "相关报告",
|
348 |
+
"article_regex": "《(.*?)》",
|
349 |
+
"date_regex": "(\\d{4}-\\d{2}-\\d{2})",
|
350 |
+
"date_format": "%Y-%m-%d"
|
351 |
+
},
|
352 |
+
{
|
353 |
+
"site": "Centaline Securities Co., Ltd.",
|
354 |
+
"pages": [0],
|
355 |
+
"date_range": 1,
|
356 |
+
"keyword": "相关报告",
|
357 |
+
"article_regex": "《(.*?)》",
|
358 |
+
"date_regex": "(\\d{4}\\s?-\\s?\\d{2}\\s?-\\s?\\d{2})",
|
359 |
+
"date_format": "%Y-%m-%d"
|
360 |
+
},
|
361 |
+
{
|
362 |
+
"site": "Tengjing Digital Research",
|
363 |
+
"pages": [0],
|
364 |
+
"date_range": 1,
|
365 |
+
"keyword": "相关报告",
|
366 |
+
"article_regex": "《(.*?)》",
|
367 |
+
"date_regex": "(\\d{4}\\s?-\\s?\\d{2}\\s?-\\s?\\d{2})",
|
368 |
+
"date_format": "%Y-%m-%d"
|
369 |
+
},
|
370 |
+
{
|
371 |
+
"site": "Guoyuan Securities",
|
372 |
+
"pages": [0],
|
373 |
+
"date_range": 1,
|
374 |
+
"keyword": "相关研究报告",
|
375 |
+
"article_regex": "《(.*?)》",
|
376 |
+
"date_regex": "\\d{4}\\s?.\\s?\\d{1,2}\\s?.\\s?\\d{1,2}",
|
377 |
+
"date_format": "%Y.%m.%d"
|
378 |
+
},
|
379 |
+
{
|
380 |
+
"site": "China Galaxy Co., Ltd.",
|
381 |
+
"pages": [0],
|
382 |
+
"date_range": 1,
|
383 |
+
"keyword": "相关报告",
|
384 |
+
"article_regex": "《(.*?)》",
|
385 |
+
"date_regex": "(\\d{4}\\s?-\\s?\\d{2}\\s?-\\s?\\d{2})",
|
386 |
+
"date_format": "%Y-%m-%d"
|
387 |
+
},
|
388 |
+
{
|
389 |
+
"site": "Shengang Securities Co., Ltd.",
|
390 |
+
"pages": [0],
|
391 |
+
"date_range": 1,
|
392 |
+
"keyword": "相关报告",
|
393 |
+
"article_regex": "《(.*?)》",
|
394 |
+
"date_regex": "(\\d{4}\\s?-\\s?\\d{2}\\s?-\\s?\\d{2})",
|
395 |
+
"date_format": "%Y-%m-%d"
|
396 |
+
},
|
397 |
+
{
|
398 |
+
"site": "SDIC Anxin Futures",
|
399 |
+
"pages": [0],
|
400 |
+
"date_range": 1,
|
401 |
+
"keyword": "相关报告",
|
402 |
+
"article_regex": "《(.*?)》",
|
403 |
+
"date_regex": "(\\d{4}\\s?-\\s?\\d{2}\\s?-\\s?\\d{2})",
|
404 |
+
"date_format": "%Y-%m-%d"
|
405 |
+
}
|
406 |
]
|
utils.py
CHANGED
@@ -123,41 +123,67 @@ def extract_reference(row):
|
|
123 |
if 'remove' in pattern:
|
124 |
for remove_string in pattern['remove']:
|
125 |
reference_titles = [s.replace(remove_string, '') for s in reference_titles]
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
if
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
161 |
except Exception as error:
|
162 |
print(error)
|
163 |
|
|
|
123 |
if 'remove' in pattern:
|
124 |
for remove_string in pattern['remove']:
|
125 |
reference_titles = [s.replace(remove_string, '') for s in reference_titles]
|
126 |
+
if len(reference_dates) > 0:
|
127 |
+
for title, date in zip(reference_titles, reference_dates):
|
128 |
+
try:
|
129 |
+
date = datetime.strptime(date, pattern['date_format'])
|
130 |
+
except:
|
131 |
+
date = datetime(2006, 1, 1)
|
132 |
+
dates = []
|
133 |
+
if 'date_range' in pattern:
|
134 |
+
for i in range(pattern['date_range'] + 1):
|
135 |
+
dates.append((date + timedelta(days=i)).strftime('%Y-%m-%d'))
|
136 |
+
dates.append((date - timedelta(days=i)).strftime('%Y-%m-%d'))
|
137 |
+
dates.append(date.strftime('%Y-%m-%d'))
|
138 |
+
date = date.strftime('%Y-%m-%d')
|
139 |
+
if 'split' in pattern:
|
140 |
+
for split_item in pattern['split']:
|
141 |
+
if 'exceptional_string' in split_item:
|
142 |
+
if split_item['string'] in title and isnot_substring(split_item['exceptional_string'], title):
|
143 |
+
title = re.split(split_item['string'], title)[split_item['index']]
|
144 |
+
else:
|
145 |
+
if split_item['string'] in title:
|
146 |
+
title = title.split(split_item['string'])[split_item['index']]
|
147 |
+
if len(data[(data['titleCN'].str.contains(title)) & (data['site'] == row['site']) & (data['publishdate'].isin(dates))]) == 0:
|
148 |
+
print("------------ = 0 ------------")
|
149 |
+
print(date, repr(title))
|
150 |
+
elif len(data[(data['titleCN'].str.contains(title)) & (data['site'] == row['site']) & (data['publishdate'].isin(dates))]) > 1:
|
151 |
+
print("------------ > 1 ------------")
|
152 |
+
print(date, repr(title))
|
153 |
+
else:
|
154 |
+
print("------------ = 1 ------------")
|
155 |
+
reference_df = data[(data['titleCN'].str.contains(title)) & (data['site'] == row['site']) & (data['publishdate'].isin(dates))]
|
156 |
+
row['referenceID'] = reference_df.iloc[0]['id']
|
157 |
+
row['link'] = reference_df.iloc[0]['link']
|
158 |
+
row['sourceID'] = row['id']
|
159 |
+
row['refID'] = uuid.uuid5(uuid.NAMESPACE_OID, str(row['sourceID'])+str(row['referenceID']))
|
160 |
+
print(date, repr(title), row['sourceID'],row['referenceID'])
|
161 |
+
update_reference(row)
|
162 |
+
else:
|
163 |
+
for title in reference_titles:
|
164 |
+
if 'split' in pattern:
|
165 |
+
for split_item in pattern['split']:
|
166 |
+
if 'exceptional_string' in split_item:
|
167 |
+
if split_item['string'] in title and isnot_substring(split_item['exceptional_string'], title):
|
168 |
+
title = re.split(split_item['string'], title)[split_item['index']]
|
169 |
+
else:
|
170 |
+
if split_item['string'] in title:
|
171 |
+
title = title.split(split_item['string'])[split_item['index']]
|
172 |
+
if len(data[(data['titleCN'].str.contains(title)) & (data['site'] == row['site'])]) == 0:
|
173 |
+
print("------------ = 0 ------------")
|
174 |
+
print(repr(title))
|
175 |
+
elif len(data[(data['titleCN'].str.contains(title)) & (data['site'] == row['site'])]) > 1:
|
176 |
+
print("------------ > 1 ------------")
|
177 |
+
print(repr(title))
|
178 |
+
else:
|
179 |
+
print("------------ = 1 ------------")
|
180 |
+
reference_df = data[(data['titleCN'].str.contains(title)) & (data['site'] == row['site'])]
|
181 |
+
row['referenceID'] = reference_df.iloc[0]['id']
|
182 |
+
row['link'] = reference_df.iloc[0]['link']
|
183 |
+
row['sourceID'] = row['id']
|
184 |
+
row['refID'] = uuid.uuid5(uuid.NAMESPACE_OID, str(row['sourceID'])+str(row['referenceID']))
|
185 |
+
print(repr(title), row['sourceID'],row['referenceID'])
|
186 |
+
update_reference(row)
|
187 |
except Exception as error:
|
188 |
print(error)
|
189 |
|