semvec/pypi-packages huggingface dataset:
numerizer 0.2.4
Python module for converting natural language numbers into ints and floats.
License: MIT

numerizer
=========

A Python module to convert natural language numerics into ints and floats.
This is a port of the Ruby gem `numerizer
<https://github.com/jduff/numerizer.git>`_

Numerizer has been tested on Python 3.9, 3.10 and 3.11.

Installation
------------

The numerizer library can be installed from PyPI as follows:

.. code:: bash

    $ pip install numerizer

Usage
-----

.. code:: python

    >>> from numerizer import numerize
    >>> numerize('forty two')
    '42'
    >>> numerize('forty-two')
    '42'
    >>> numerize('four hundred and sixty two')
    '462'
    >>> numerize('one fifty')
    '150'
    >>> numerize('twelve hundred')
    '1200'
    >>> numerize('twenty one thousand four hundred and seventy three')
    '21473'
    >>> numerize('one million two hundred and fifty thousand and seven')
    '1250007'
    >>> numerize('one billion and one')
    '1000000001'
    >>> numerize('nine and three quarters')
    '9.75'
    >>> numerize('platform nine and three quarters')
    'platform 9.75'


Using the SpaCy extension
^^^^^^^^^^^^^^^^^^^^^^^^^

Since version 0.2, numerizer is available as a `SpaCy extension <https://spacy.io/usage/processing-pipelines#custom-components-attributes>`_.

Any named entities of a quantitative nature within a SpaCy document can be numerized as follows:

.. code:: python

    >>> from spacy import load
    >>> nlp = load('en_core_web_sm')  # or load any other spaCy model
    >>> doc = nlp('The projected revenue for the next quarter is over two million dollars.')
    >>> doc._.numerize()
    {the next quarter: 'the next 1/4', over two million dollars: 'over 2000000 dollars'}

Users can specify which entity types are to be numerized, by using the `labels` argument in the extension function, as follows:

.. code:: python

    >>> doc._.numerize(labels=['MONEY'])  # only numerize entities of type 'MONEY'
    {over two million dollars: 'over 2000000 dollars'}


The extension is available for tokens and spans as well.

.. code:: python

    >>> two_million = doc[-4:-2]  # span corresponding to "two million"
    >>> two_million._.numerize()
    '2000000'
    >>> quarter = doc[6]  # token corresponding to "quarter"
    >>> quarter._.numerized
    '1/4'


Extras
------

For R users, a wrapper library has been developed by `@amrrs <https://github.com/amrrs>`_. Try it out `here <https://github.com/amrrs/numerizer.git>`_.
pdf2table 0.1.4
pdf2table is a powerful Python tool designed to streamline the extraction of tabular data from PDF documents.
License: MIT

# pdf2table
[![PyPI](https://img.shields.io/pypi/v/pdf2table.svg)](https://pypi.org/project/pdf2table/)
[![PyPI - Downloads](https://img.shields.io/pypi/dm/pdf2table)](https://img.shields.io/pypi/dm/pdf2table)
![GitHub](https://img.shields.io/github/license/li-rongzhi/pdf2table.svg)

pdf2table is a Python library designed to extract tabular data from PDF files and images efficiently and accurately. It leverages an enhanced algorithm of `img2table` library for table detection and the TATR model from Microsoft's Table Transformer for precise table structure recognition and content extraction.

## Features
- **High Precision of Detection**: Compared to Table Transformer's DETR model, rule-based algorithm is less likely to identify text blocks as table regions.
- **Maintenance Structural Information**: Utilizes state-of-the-art models for table structure recognition to maintain structural information of tables.
- **Flexible Input**: Supports both PDF files and image formats for table extraction. (More file format will be available later)
- **Easy to Use**: Simple API allows for straightforward integration into Python projects.

## Installation

Install pdf2table using pip:

```bash
pip install pdf2table
```

## Usage
Here's a quick example on how to use PDF2Table to extract tables from a PDF file:
```python
from pdf2table import Driver

# Initialize the driver
driver = Driver()

# Extract tables from a PDF
# which returns a list of dataframes
tables = driver.extract_tables("sample.pdf")

```
`Driver` object encapsulates the detection and extraction for both `PDF` object and `Image` object. If detection is what you need, please refer to the following example:
```python
from pdf2table.document import Image, PDF

# Initialize an Image object
img = Image("sample.jpg")

# Extract all tables from the image
# which returns a list of Table objects
img_tables = img.extract_tables()

# Initialize an PDF object
pdf = PDF("sample.jpg")
pdf_tables = pdf.extract_tables()
```
You may refer to [tutorial](samples/tutorial.ipynb) for more details
## License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

## Acknowledgements
Thanks to the creators of the [img2table](https://github.com/xavctn/img2table) library and Microsoft's [Table Transformer](https://github.com/microsoft/table-transformer) model for providing the robust foundations for this tool.