123456789101112131415161718192021222324 |
- # -*- coding: utf-8 -*-
- import json
- import pkgutil
- _file = pkgutil.get_data(__package__, 'equipment_info.json')
- _equipment_data = json.loads(_file)
- def extractor(text_list):
- for text in text_list:
- result = dict()
- result.update({'str': text})
- for (name, params) in _equipment_data.items():
- if name in text:
- result.update({'equipment': name})
- for param in params:
- if param in text:
- result.update({'param': param})
- if 'param' not in result.keys():
- result.update({'param': ''})
- yield result
|