Metadata-Version: 2.1
Name: po2dataset
Version: 0.3.1
Summary: Python tool to extract sentences from po files and create language datasets for NLP machine learning
Author-email: Urtzi Odriozola <urtzi.odriozola@gmail.com>
License: MIT License
        
        Copyright 2024 Urtzi Odriozola Lizaso
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Project-URL: Homepage, https://github.com/urtzai/po2dataset
Project-URL: Documentation, https://github.com/urtzai/po2dataset/blob/main/README.md
Project-URL: Repository, https://github.com/urtzai/po2dataset
Project-URL: Bug Tracker, https://github.com/urtzai/po2dataset/issues
Project-URL: Changelog, https://github.com/urtzai/po2dataset/blob/main/CHANGELOG.md
Keywords: po,dataset,NLP,argostranslate,libretranslate,language,translation
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Topic :: Software Development :: Build Tools
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: polib==1.2.0
Requires-Dist: argparse==1.4.0
Requires-Dist: tox==4.23.2
Requires-Dist: requests==2.32.3

# PO2Dataset

[![PyPI version](https://badge.fury.io/py/po2dataset.svg)](https://badge.fury.io/py/po2dataset)
[![PyPI Supported Python Versions](https://img.shields.io/pypi/pyversions/po2dataset.svg)](https://pypi.python.org/pypi/po2dataset/)
[![check](https://github.com/urtzai/po2dataset/actions/workflows/python-test.yml/badge.svg)](https://github.com/urtzai/po2dataset/actions/workflows/python-test.yml)

**po2dataset** is a python tool to extract sentences from po files and create language datasets for machine translation.

This command line tool is intended to create dataset packages suitable for [Argos Train](https://github.com/argosopentech/argos-train).

## How to install

### From pip

```bash
pip install po2dataset
```

### Manual installation

Create a virtual environment using [virtualenv](https://virtualenv.pypa.io/en/latest/index.html)

```bash
git clone https://github.com/urtzai/po2dataset.git
virtualenv po2dataset
cd po2dataset
source ./bin/activate
```

## Quick start guide

### Create Argos Train suitable dataset

```bash
po2dataset <path_to_po_file> --name <project_name> --source_code <source_lang_code> --target_code <target_lang_code> --ref "Some reference information of the project"
```

Where:

- `name`: The name of the project
- `source_code`: Source language code ([ISO 639](https://en.wikipedia.org/wiki/ISO_639))
- `target_code`: Target language code ([ISO 639](https://en.wikipedia.org/wiki/ISO_639))
- `ref`: Some reference information of the project

Optional arguments:

- `format`: Extension name of the zip file (default **argosdata**)
- `license`: License to add into the package (default [**CC0**](https://creativecommons.org/publicdomain/zero/1.0/)). Options are: CC0, CC-BY, CC-BY-SA

### Usage Examples

#### Basic Dataset Creation

To create a dataset from a .po file for an English-Basque translation project, run:

```bash
po2dataset path/to/yourfile.po --name "MyProject" --source_code en --target_code eu --ref "Translation dataset for project X"
```

#### Specifying Format and License

For custom file format and license, use:

```bash
po2dataset path/to/yourfile.po --name "MyProject" --source_code en --target_code eu --format "customzip" --license "CC-BY"
```

These commands create language dataset packages, with customizable file formats and licensing options.

## Support

Should you experience any issues do not hesistate to post an issue or contribute in this project pulling requests.
