Metadata-Version: 2.4
Name: numtag
Version: 0.0.1a2
Summary: Find every number in a text: exact values as digit strings, kinds and character spans.
Author: TigreGotico
License: Apache-2.0
Project-URL: Homepage, https://github.com/TigreGotico/numtag
Project-URL: Repository, https://github.com/TigreGotico/numtag
Project-URL: Issues, https://github.com/TigreGotico/numtag/issues
Keywords: numbers,numerals,nlp,tagger,parser
Classifier: Development Status :: 2 - Pre-Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Text Processing :: Linguistic
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Provides-Extra: test
Requires-Dist: pytest; extra == "test"
Dynamic: license-file

# numtag

numtag finds every number in a text. For each number it gives the exact words, their character offsets, the value and the kind.

```python
from numtag import tag_numbers

tag_numbers("comprou duas dúzias de ovos e um milhão de euros", "pt-PT")
# [NumberMention(char_span=(8, 19), text='duas dúzias', value='24', kind=Kind.CARDINAL, ...),
#  NumberMention(char_span=(30, 39), text='um milhão', value='1000000', kind=Kind.CARDINAL, ...)]
```

A value is a digit string with no limit on its length: "24", "-2.5" or "1/3". numtag never converts a value to `int` or `float`, so no rounding changes a digit. Convert it with `int()`, `decimal.Decimal()` or `fractions.Fraction()` when you need a number.

The language rules are data files in `numtag/lexicon/`, one per language, with the source of each rule in the file.
