Closed jmrohwer closed 3 years ago
I fixed the bug by changing the regex for "s" to conditionally match only if there is a single "s". Hence, all other expressions with a trailing "s" are now parsed as intended.
Dimensionless units such as "abs" or purely "dimensionless" are already handled before the unitParser is even called in the unitCreator module. See the following code:
The bug was fixed in b8b6cff and dimensionless unit handling improved in 127735c.
Dimensionless units "abs" and "absorbance" were dropped (see issue #8 ). The given issue is now resolved and closed.
Currently, because "s" is also part of the regex for unit parsing, any unit ending in "s" (celsius, minutes, seconds, hours) is not parsed correctly: https://github.com/EnzymeML/PyEnzyme/blob/32011fc22ee36bece374dedd2a30454ff384eb77/pyenzyme/enzymeml/tools/unitparser.py#L104-L106 The consequence is that "celsius" would be matched, the prefix would be "celsiu" and the unit "s" which gives an error further on.
Furthermore, the dimensionless units are not included in the regex.
The above can be fixed by the following, i.e. matching for the "s" separately if the first regex does not find a match (although there may be a more elegant way):