Hungarian Date Parser
A tool for extracting datetime intervals from Hungarian sentences and turning datetime objects into Hungarian text.
Install and try the package with pip install hun-date-parser.
🔥 Usage
If not specified otherwise, relative dates (eg.: tomorrow, next week, etc.) are calculated relative to the current datetime, at the time when the DatetimeExtractor is instanciated.
from hun_date_parser import DatetimeExtractor
datetime_extractor = DatetimeExtractor()
datetime_extractor.parse_datetime('találkozzunk jövő kedd délután!')
# {'start_date': datetime.datetime(2020, 12, 29, 12, 0), 'end_date': datetime.datetime(2020, 12, 29, 17, 59, 59)}
datetime_extractor.parse_datetime('találkozzunk szombaton háromnegyed nyolc előtt két perccel')
# {'start_date': datetime.datetime(2020, 12, 26, 7, 43), 'end_date': datetime.datetime(2020, 12, 26, 7, 43, 59)}
The date parser is also capable of parsing explicit intervals from the text even when only one side of the interval is specified.
datetime_extractor.parse_datetime('2020 decemberétől 2021 januárig')
# {'start_date': datetime.datetime(2020, 12, 1, 0, 0), 'end_date': datetime.datetime(2021, 1, 31, 23, 59, 59)}
datetime_extractor.parse_datetime('2020 decemberéig')
# {'start_date': None, 'end_date': datetime.datetime(2020, 12, 31, 23, 59, 59)}
The library is also capable of turning datetime objects into their Hungarian text representation.
from datetime import datetime
from hun_date_parser import DatetimeTextualizer
datetime_textualizer = DatetimeTextualizer()
datetime_textualizer.generate_candidates()
datetime_textualizer.generate_candidates(datetime(2020, 12, 20, 18, 34), time_precision=2)
# {'date': ['ezen a héten vasárnap', '2020 december 20'],
# 'times': ['tizennyolc óra harmincnégy perc', '18:34', 'este hat óra harmincnégy perc', 'este fél 7 után 4 perccel']}
📝 License
This project is licensed under Apache-2.0 license. Feel free to use it in your own projects.
🔧 Contribute
Any help or feedback in further developing the library is welcome!
Metadata
Release files for hun-date-parser-nsoma97 0.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| hun-date-parser-nsoma97-0.0.1.tar.gz | 12.9 kB | Without provenance | Details for hun-date-parser-nsoma97-0.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| hun_date_parser_nsoma97-0.0.1-py3-none-any.whl | Python 3 | none | any | Details for hun_date_parser_nsoma97-0.0.1-py3-none-any.whl |
Total release size: 34.2 kB
Release files / hun-date-parser-nsoma97-0.0.1.tar.gz
| Download URL | hun-date-parser-nsoma97-0.0.1.tar.gz |
|---|---|
| Size | 12.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fb4157254d49393113b8e21ae93b80799f8602e6097f7037d6875d615b47f766
|
|
BLAKE2b-256 checksum How to use checksums |
0cecfe633b292a6f0de92dac57c9988d4062105b2e336fd55595a22a823e3972
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/51.1.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4
|
Release files / hun_date_parser_nsoma97-0.0.1-py3-none-any.whl
| Download URL | hun_date_parser_nsoma97-0.0.1-py3-none-any.whl |
|---|---|
| Size | 21.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d78fb6c2a212251a43aa9bc6e8b1ed57f404fcf35c57ccd0859d6357b17aa709
|
|
BLAKE2b-256 checksum How to use checksums |
74694f2fdc1af3025dcdc9835e8f1bd42962751b265a226fa2811f4857787b9a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/51.1.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4
|
Security for hun-date-parser-nsoma97 0.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.