A 10% can be a target value in one industry and something to discard in another. In construction management, “operating profit of about 10%” is not progress, but in accounting it is exactly that figure.
Therefore this function does not choose. It returns the number together with its label, and the caller decides what it represents. If the engine chooses for you, it will be correct for one industry and inevitably wrong for others.
Method
Description
Zio.utils.numbers(text, near=None, kinds=None)
Finds all numbers in the text and returns them as a list. If there are multiple lines, it looks line by line—because labels do not span lines.
Zio.utils.number(text, near=None, kinds=None)
Returns the first of the same kind. Returns None if none is found.
8/7 is read as three possibilities — August 7, the 8th of 7 items, or 7⁄8. Choosing one will silently make the other two wrong, and from then on this function becomes unreliable.
The entire reading is returned so that the caller can decide based on context. Amounts are also ambiguous — 2억 3천 could be 200 003 000 or, if “만” is omitted by habit, 230 000 000. Provide both value and maybe.
If you return only numbers, they can be used anywhere. The words written next to them allow the caller to infer meaning. Therefore, extracting labels is the most carefully handled part of this bundle.
Original
label
rule
진척률 : 약 90%
진척률
: marks the label before it. This is opposite to other delimiters.
( 매출 194,132,600원 / 영업 이익 약 10% )
매출, 영업 이익
Parentheses and slashes separate fields. The thousands separator (194,132,600) does not split the field.
장비 발주(8/7)
장비 발주
If the parentheses contain only a number, look one more step back for the label.
영업 이익 약 9%
영업 이익, about
Words like 약, 총, 최대 are removed from the label; only their meaning remains.
numbers()first finds everything. If nothing is found, the caller has no way to handle it, but if many are found you can reduce them with near and kinds. The words put into near are always supplied by the caller — putting a word like 진척률 inside the SDK makes it less of a common tool.