diff --git a/CHANGELOG.md b/CHANGELOG.md index 8c918f68..8fb7bea6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,24 +1,12 @@ # Changelog -## [0.1.5a1](https://github.com/OpenVoiceOS/skill-ovos-weather/tree/0.1.5a1) (2024-11-05) +## [0.1.6a1](https://github.com/OpenVoiceOS/skill-ovos-weather/tree/0.1.6a1) (2024-11-12) -[Full Changelog](https://github.com/OpenVoiceOS/skill-ovos-weather/compare/0.1.5a1...0.1.5a1) +[Full Changelog](https://github.com/OpenVoiceOS/skill-ovos-weather/compare/0.1.5...0.1.6a1) **Merged pull requests:** -- fix: gui resources path [\#84](https://github.com/OpenVoiceOS/skill-ovos-weather/pull/84) ([JarbasAl](https://github.com/JarbasAl)) - -## [0.1.5a1](https://github.com/OpenVoiceOS/skill-ovos-weather/tree/0.1.5a1) (2024-11-04) - -[Full Changelog](https://github.com/OpenVoiceOS/skill-ovos-weather/compare/0.1.4...0.1.5a1) - -**Closed issues:** - -- Weather skill not working on Basic install [\#83](https://github.com/OpenVoiceOS/skill-ovos-weather/issues/83) - -**Merged pull requests:** - -- da-dk/translate [\#82](https://github.com/OpenVoiceOS/skill-ovos-weather/pull/82) ([gitlocalize-app[bot]](https://github.com/apps/gitlocalize-app)) +- fix: drop lingua-franca [\#85](https://github.com/OpenVoiceOS/skill-ovos-weather/pull/85) ([JarbasAl](https://github.com/JarbasAl)) diff --git a/__init__.py b/__init__.py index 6e3cc28b..6adc71f8 100644 --- a/__init__.py +++ b/__init__.py @@ -23,8 +23,8 @@ from time import sleep from typing import List -from lingua_franca.parse import extract_number -from lingua_franca.format import ( +from ovos_number_parser import extract_number +from ovos_date_parser import ( nice_time, nice_weekday, get_date_strings @@ -847,7 +847,7 @@ def _display_multi_day_scalable(self, forecast: List[Weather]): weatherCondition=day.condition.animated_code, highTemperature=day.temperature_high, lowTemperature=day.temperature_low, - date=nice_weekday(day.date_time, self.lang)[:3], + date=nice_weekday(day.date_time, lang=self.lang)[:3], ) ) self.gui["forecast"] = dict(all=display_data) @@ -1049,7 +1049,7 @@ def _format_time(self, dt: datetime) -> str: the value to display on the screen """ return nice_time(dt, - self.lang, + lang=self.lang, speech=False, use_24hour = self.use_24h, use_ampm = not self.use_24h) diff --git a/requirements.txt b/requirements.txt index c1f5b455..d30bfacf 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,8 @@ requests>=2.31.0 pytz ovos-utils>=0.0.28 -ovos-workshop>=0.0.16,<3.0.0 +ovos-workshop>=2.2.0,<3.0.0 +ovos-number-parser>=0.0.1,<1.0.0 +ovos-date-parser>=0.0.2,<1.0.0 +ovos-utterance-normalizer>=0.0.1,<1.0.0 +ovos-backend-client>=1.0.1,<2.0.0 diff --git a/version.py b/version.py index b58f0b7b..bbc36897 100644 --- a/version.py +++ b/version.py @@ -1,6 +1,6 @@ # START_VERSION_BLOCK VERSION_MAJOR = 0 VERSION_MINOR = 1 -VERSION_BUILD = 5 -VERSION_ALPHA = 0 +VERSION_BUILD = 6 +VERSION_ALPHA = 1 # END_VERSION_BLOCK diff --git a/weather_helpers/dialog.py b/weather_helpers/dialog.py index 110367ac..878c9615 100644 --- a/weather_helpers/dialog.py +++ b/weather_helpers/dialog.py @@ -32,14 +32,14 @@ The skill class will use the "name" and "data" attributes to pass to the TTS process. """ -# TODO - get rid of relative imports as soon as skills can be properly packaged with arbitrary module structures -from typing import List from os.path import dirname +# TODO - get rid of relative imports as soon as skills can be properly packaged with arbitrary module structures +from typing import List, Optional -from lingua_franca.format import join_list, nice_time +from ovos_date_parser import nice_time from ovos_utils.time import now_local from ovos_workshop.resource_files import SkillResources - +from ovos_workshop.skills.ovos import join_word_list from .intent import WeatherIntent from .util import get_speakable_day_of_week, get_time_period from .weather import ( @@ -50,7 +50,6 @@ WeatherReport ) - # TODO: MISSING DIALOGS # - current.clear.alternative.local # - current.clouds.alternative.local @@ -77,7 +76,7 @@ def lang(self): def translate(self, dialog, data=None): data = data or dict() - return self.resources.render_dialog(dialog, data=data) + return self.resources.render_dialog(dialog, data=data) def _add_location(self): """Add location information to the dialog.""" @@ -212,7 +211,7 @@ def __init__(self, intent_data: WeatherIntent, weather: Weather): super().__init__(intent_data) self.weather = weather self.name = HOURLY - + def build_weather_dialog(self): """Build the components necessary to speak the forecast for a hour.""" self.name += "-weather" @@ -223,7 +222,7 @@ def build_weather_dialog(self): ) self._add_location() - def build_temperature_dialog(self, _ = None): + def build_temperature_dialog(self, _=None): """Build the components necessary to speak the hourly temperature.""" self.name += "-temperature" self.data = dict( @@ -428,7 +427,7 @@ def build_condition_dialog(self, condition: str): if daily.condition.category == condition: day = get_speakable_day_of_week(daily.date_time, lang=self.lang) days_with_condition.append(day) - self.data.update(days=join_list(days_with_condition, "and")) + self.data.update(days=join_word_list(days_with_condition, connector="and", sep=",", lang=self.lang)) def get_dialog_for_timeframe(intent_data: WeatherIntent, diff --git a/weather_helpers/intent.py b/weather_helpers/intent.py index 1eb7bebd..a0b9497a 100644 --- a/weather_helpers/intent.py +++ b/weather_helpers/intent.py @@ -17,8 +17,7 @@ from datetime import timedelta from ovos_utils.time import now_local -from lingua_franca.parse import normalize - +from ovos_utterance_normalizer import UtteranceNormalizerPlugin from .util import ( get_utterance_datetime, get_geolocation, @@ -40,9 +39,8 @@ def __init__(self, message, weather_config: WeatherConfig): :param language: The configured language of the device """ self.message = message - self.utterance = normalize(message.data["utterance"], - weather_config.lang, - remove_articles=False) + normalizer = UtteranceNormalizerPlugin.get_normalizer(lang=weather_config.lang) + self.utterance = normalizer.normalize(message.data["utterance"]) self.location = message.data.get("location") self.config = weather_config self.scale = None diff --git a/weather_helpers/util.py b/weather_helpers/util.py index 566bc9dd..3cdb4762 100644 --- a/weather_helpers/util.py +++ b/weather_helpers/util.py @@ -17,8 +17,8 @@ from itertools import islice import pytz -from lingua_franca.format import nice_date -from lingua_franca.parse import extract_datetime + +from ovos_date_parser import nice_date, extract_datetime from ovos_backend_client.api import GeolocationApi from ovos_utils.time import now_local, to_local @@ -65,7 +65,7 @@ def get_utterance_datetime( else: intent_timezone = get_tz_info(timezone) anchor_date = datetime.now(intent_timezone) - extract = extract_datetime(utterance, anchor_date, language) + extract = extract_datetime(utterance, anchorDate=anchor_date, lang=language) if extract is not None: utterance_datetime, _ = extract return utterance_datetime