# Weather-Retriever
**Weather-Retriever** is a Python package that allows users to retrieve and format weather information in natural language, specifically tailored for Korean speakers. It leverages data from [OpenWeatherMap](https://openweathermap.org/) and incorporates natural language processing (NLP) techniques to extract temporal and location information from user queries. The package presents weather forecasts in a user-friendly format, accommodating Korean-language date expressions and appropriate word forms.
## Features
- Retrieve real-time weather data from OpenWeatherMap.
- Understand and process natural language queries in Korean.
- Cache city coordinates for efficient API usage.
- Format weather forecasts in an easily readable manner.
## Building the Package
1. Prepare for Packaging:
- Ensure the city coordinate file is saved correctly in '~/.weather_retriever'.
2. Create a Distribution:
- Build the package using `setuptools`:
```bash
# pip install setuptools wheel
python setup.py sdist bdist_wheel
```
3. Publish to PyPI:
- Use `twine` to upload the package:
```bash
# pip install twine
python -m twine upload dist/*
```
## Installation
You can install WeatherRetriever in two ways:
1. Install via PyPI:
```bash
# https://pypi.org/project/weather_retriever/0.1.8/
pip install weather_retriever
```
- This method allows you to install the package directly from PyPI.
2. Install from GitHub:
```bash
git clone https://github.com/KimRass/weather_retriever
cd weather_retriever
pip install .
```
- This method is useful if you want to access the latest code or contribute to the project.
## Usage
```python
from weather_retriever import WeatherRetriever
# The OpenWeatherMap API key must be provided when initializing `WeatherRetriever`.
owm_api_key = "YOUR_OPENWEATHERMAP_API_KEY"
wr = WeatherRetriever(owm_api_key)
query = "YOUR_QUERY"
# Ensure network access is available to retrieve real-time weather data.
response = wr.query(query)
print(response)
```
- The package also includes intelligent caching of city coordinates to minimize redundant API calls.
### Query Examples
- "내일 서울 날씨는 어때?"
- "사흘 뒤의 상하이 날씨 어때?"
- "2024년 11월 6일의 런던 날씨는 어떻습니까?"
- "내일 오전 워싱턴 날씨는?"
- "내일과 2024년 11월 8일의 부산 날씨는 어떻습니까?"
- "뉴욕 날씨를 알려주세요. 내일과 모레에 대해서."
### File Handling
- The package saves city coordinate data in '~/.weather_retriever/city_coords.json' to cache information for efficient lookups.
- The `pathlib` library is used for managing file and directory operations.
## Testing
- To run the tests, you can use Python's built-in unittest framework or pytest. To execute the tests, simply run:
```bash
pytest
```
## License
- This project is licensed under the Apache License 2.0. See the [LICENSE](LICENSE) file for more details.
Raw data
{
"_id": null,
"home_page": "https://github.com/KimRass/weather_retriever",
"name": "weather-retriever",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": null,
"author": "KimRass",
"author_email": "purflow64@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/ec/41/fa65be8f66989b2c2e1365bc59fa146f361d811d594dd5afc1db65a0ddb1/weather_retriever-0.1.13.tar.gz",
"platform": null,
"description": "# Weather-Retriever\n\n**Weather-Retriever** is a Python package that allows users to retrieve and format weather information in natural language, specifically tailored for Korean speakers. It leverages data from [OpenWeatherMap](https://openweathermap.org/) and incorporates natural language processing (NLP) techniques to extract temporal and location information from user queries. The package presents weather forecasts in a user-friendly format, accommodating Korean-language date expressions and appropriate word forms.\n\n## Features\n- Retrieve real-time weather data from OpenWeatherMap.\n- Understand and process natural language queries in Korean.\n- Cache city coordinates for efficient API usage.\n- Format weather forecasts in an easily readable manner.\n\n## Building the Package\n1. Prepare for Packaging:\n - Ensure the city coordinate file is saved correctly in '~/.weather_retriever'.\n2. Create a Distribution:\n - Build the package using `setuptools`:\n ```bash\n # pip install setuptools wheel\n python setup.py sdist bdist_wheel\n ```\n3. Publish to PyPI:\n - Use `twine` to upload the package:\n ```bash\n # pip install twine\n python -m twine upload dist/*\n ```\n\n## Installation\nYou can install WeatherRetriever in two ways:\n1. Install via PyPI:\n ```bash\n # https://pypi.org/project/weather_retriever/0.1.8/\n pip install weather_retriever\n ```\n - This method allows you to install the package directly from PyPI.\n2. Install from GitHub:\n ```bash\n git clone https://github.com/KimRass/weather_retriever\n cd weather_retriever\n pip install .\n ```\n - This method is useful if you want to access the latest code or contribute to the project.\n\n## Usage\n```python\nfrom weather_retriever import WeatherRetriever\n\n# The OpenWeatherMap API key must be provided when initializing `WeatherRetriever`.\nowm_api_key = \"YOUR_OPENWEATHERMAP_API_KEY\"\nwr = WeatherRetriever(owm_api_key)\n\nquery = \"YOUR_QUERY\"\n# Ensure network access is available to retrieve real-time weather data.\nresponse = wr.query(query)\nprint(response)\n```\n- The package also includes intelligent caching of city coordinates to minimize redundant API calls.\n\n### Query Examples\n- \"\ub0b4\uc77c \uc11c\uc6b8 \ub0a0\uc528\ub294 \uc5b4\ub54c?\"\n- \"\uc0ac\ud758 \ub4a4\uc758 \uc0c1\ud558\uc774 \ub0a0\uc528 \uc5b4\ub54c?\"\n- \"2024\ub144 11\uc6d4 6\uc77c\uc758 \ub7f0\ub358 \ub0a0\uc528\ub294 \uc5b4\ub5bb\uc2b5\ub2c8\uae4c?\"\n- \"\ub0b4\uc77c \uc624\uc804 \uc6cc\uc2f1\ud134 \ub0a0\uc528\ub294?\"\n- \"\ub0b4\uc77c\uacfc 2024\ub144 11\uc6d4 8\uc77c\uc758 \ubd80\uc0b0 \ub0a0\uc528\ub294 \uc5b4\ub5bb\uc2b5\ub2c8\uae4c?\"\n- \"\ub274\uc695 \ub0a0\uc528\ub97c \uc54c\ub824\uc8fc\uc138\uc694. \ub0b4\uc77c\uacfc \ubaa8\ub808\uc5d0 \ub300\ud574\uc11c.\"\n\n### File Handling\n- The package saves city coordinate data in '~/.weather_retriever/city_coords.json' to cache information for efficient lookups.\n- The `pathlib` library is used for managing file and directory operations.\n\n## Testing\n- To run the tests, you can use Python's built-in unittest framework or pytest. To execute the tests, simply run:\n ```bash\n pytest\n ```\n\n## License\n- This project is licensed under the Apache License 2.0. See the [LICENSE](LICENSE) file for more details.\n\n\n",
"bugtrack_url": null,
"license": "Apache License 2.0",
"summary": "Natural Language Weather Retriever",
"version": "0.1.13",
"project_urls": {
"Homepage": "https://github.com/KimRass/weather_retriever"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "561c3dd8ca1245e24e08a7156df99237d8363fd250c50b2089abf0552e2a8339",
"md5": "c65903810a41c0d23fb4778fc647b0d0",
"sha256": "879c92451efbeb95f204ce5b202aa83ed7a0a2641d9e11b2eb3607f0d01cad4f"
},
"downloads": -1,
"filename": "weather_retriever-0.1.13-py3-none-any.whl",
"has_sig": false,
"md5_digest": "c65903810a41c0d23fb4778fc647b0d0",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 15141,
"upload_time": "2024-11-05T12:44:31",
"upload_time_iso_8601": "2024-11-05T12:44:31.991883Z",
"url": "https://files.pythonhosted.org/packages/56/1c/3dd8ca1245e24e08a7156df99237d8363fd250c50b2089abf0552e2a8339/weather_retriever-0.1.13-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "ec41fa65be8f66989b2c2e1365bc59fa146f361d811d594dd5afc1db65a0ddb1",
"md5": "0ef45b39f1cdc2f1f739bcbac60a8724",
"sha256": "47b99c103563f6793748bb26f857fba75ea58cd68454018050a1f124f54bf618"
},
"downloads": -1,
"filename": "weather_retriever-0.1.13.tar.gz",
"has_sig": false,
"md5_digest": "0ef45b39f1cdc2f1f739bcbac60a8724",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 14831,
"upload_time": "2024-11-05T12:44:34",
"upload_time_iso_8601": "2024-11-05T12:44:34.706110Z",
"url": "https://files.pythonhosted.org/packages/ec/41/fa65be8f66989b2c2e1365bc59fa146f361d811d594dd5afc1db65a0ddb1/weather_retriever-0.1.13.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-11-05 12:44:34",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "KimRass",
"github_project": "weather_retriever",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [
{
"name": "torch",
"specs": []
},
{
"name": "transformers",
"specs": []
},
{
"name": "dateparser",
"specs": []
},
{
"name": "requests",
"specs": []
},
{
"name": "numpy",
"specs": []
}
],
"lcname": "weather-retriever"
}