34f14dac8d65ffd6210a87a610afad1593d47294,ner_v1/detectors/numeral/budget/budget_detection.py,BudgetDetector,__init__,#BudgetDetector#Any#Any#Any#Any#,80
Before Change
self.tag = "__" + self.entity_name + "__"
self._use_text_detection = use_text_detection
self._allowed_units = [
(["k", "ha?zaa?r", "ha?ja?ar", "thousa?nd"], 1000),
(["l", "lacs?", "lakh?s?", "lakhs"], 100000),
(["m", "mn", "million", "mill?"], 1000000),
(["c", "cro?", "crore?s?"], 10000000),
]
units = []
for _units, scale in self._allowed_units:
units.extend(_units)
units.sort(key=lambda unit: len(unit), reverse=True)
digits_pattern = r"((?:\d+(?:\,\d+)*(?:\.\d+)?)|(?:(?:\d+(?:\,\d+)*)?(?:\.\d+)))"
units_pattern = r"({})?".format("|".join(units))
After Change
scales, units = zip(*sorted(
list(BudgetDetector._scale_patterns.items()), key=lambda scale_pattern: len(scale_pattern[1]), reverse=True
))
self._scale_compiled_patterns = [(scale, re.compile(unit)) for scale, unit in zip(scales, units)]
digits_pattern = r"((?:\d+(?:\,\d+)*(?:\.\d+)?)|(?:(?:\d+(?:\,\d+)*)?(?:\.\d+)))"
units_pattern = r"({})?".format("|".join(units))
self._budget_pattern = r"(?:rs\.|rs|rupees|rupee)?" \
r"\s*{}\s*{}\s*" \
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 11
Instances
Project Name: hellohaptik/chatbot_ner
Commit Name: 34f14dac8d65ffd6210a87a610afad1593d47294
Time: 2019-06-18
Author: jain.chirag925@gmail.com
File Name: ner_v1/detectors/numeral/budget/budget_detection.py
Class Name: BudgetDetector
Method Name: __init__
Project Name: GoogleCloudPlatform/python-docs-samples
Commit Name: f427368dc042ade0b12459935014ce9dd4e626a5
Time: 2018-03-29
Author: dizcology@hotmail.com
File Name: vision/cloud-client/detect/detect.py
Class Name:
Method Name: detect_document
Project Name: GoogleCloudPlatform/python-docs-samples
Commit Name: f427368dc042ade0b12459935014ce9dd4e626a5
Time: 2018-03-29
Author: dizcology@hotmail.com
File Name: vision/cloud-client/detect/detect.py
Class Name:
Method Name: detect_document_uri