Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2.0.1 #55

Merged
merged 6 commits into from
Jul 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
# Changelog

## [2.0.0](https://github.com/NeonGeckoCom/skill-fallback_unknown/tree/2.0.0) (2024-03-27)
## [2.0.1a2](https://github.com/NeonGeckoCom/skill-fallback_unknown/tree/2.0.1a2) (2024-05-10)

[Full Changelog](https://github.com/NeonGeckoCom/skill-fallback_unknown/compare/1.2.1a1...2.0.0)
[Full Changelog](https://github.com/NeonGeckoCom/skill-fallback_unknown/compare/2.0.1a1...2.0.1a2)

**Implemented enhancements:**
**Merged pull requests:**

- Refactor `neon_must_respond` [\#7](https://github.com/NeonGeckoCom/skill-fallback_unknown/issues/7)
- Patch out file resolution error [\#54](https://github.com/NeonGeckoCom/skill-fallback_unknown/pull/54) ([NeonDaniel](https://github.com/NeonDaniel))

## [1.2.1a1](https://github.com/NeonGeckoCom/skill-fallback_unknown/tree/1.2.1a1) (2024-03-02)
## [2.0.1a1](https://github.com/NeonGeckoCom/skill-fallback_unknown/tree/2.0.1a1) (2024-04-25)

[Full Changelog](https://github.com/NeonGeckoCom/skill-fallback_unknown/compare/1.2.0...1.2.1a1)
[Full Changelog](https://github.com/NeonGeckoCom/skill-fallback_unknown/compare/2.0.0...2.0.1a1)

**Merged pull requests:**

- Extend FallbackSkill from ovos-workshop [\#50](https://github.com/NeonGeckoCom/skill-fallback_unknown/pull/50) ([NeonDaniel](https://github.com/NeonDaniel))
- Loosen dependencies to support ovos-utils 0.1 [\#52](https://github.com/NeonGeckoCom/skill-fallback_unknown/pull/52) ([NeonDaniel](https://github.com/NeonDaniel))



Expand Down
16 changes: 12 additions & 4 deletions __init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from os.path import join, isfile
from ovos_workshop.decorators import fallback_handler
from ovos_workshop.skills.fallback import FallbackSkill
from neon_utils.message_utils import request_for_neon
Expand Down Expand Up @@ -71,13 +72,21 @@ def _read_voc_lines(self, name) -> filter:
:param name: vocab resource name
:returns: filter for specified vocab resource
"""
with open(self.find_resource(name + '.voc', 'vocab')) as f:
vocab = self.find_resource(f"{name}.voc", 'vocab',
lang=self.lang)
if self.lang not in vocab:
test_path = join(self.root_dir, "vocab", self.lang, f"{name}.voc")
if isfile(test_path):
LOG.warning(f"Resolved {vocab} but using {test_path}")
vocab = test_path
LOG.debug(f"Reading voc file {vocab} for lang={self.lang}")
with open(vocab) as f:
return filter(bool, map(str.strip, f.read().split('\n')))

@fallback_handler(priority=100)
def handle_fallback(self, message: Message):
LOG.info("Unknown Fallback Checking for Neon!!!")
utterance = message.data['utterance']
LOG.info(f"Unknown Fallback handling: {utterance}")
client = message.context.get('client')
ww_state = self.config_core.get("listener", {}).get("wake_word_enabled",
True)
Expand Down Expand Up @@ -110,12 +119,11 @@ def handle_fallback(self, message: Message):
}))

LOG.debug(f"Checking if neon must respond: {message.data}")

# Determine what kind of question this is to reply appropriately
for i in ['question', 'who.is', 'why.is']:
for line in self._read_voc_lines(i):
if utterance.startswith(line):
LOG.info('Fallback type: ' + i)
LOG.info(f'Fallback type: {i} ({utterance})')
self.speak_dialog(i,
data={'remaining': line.replace(i, '')})
return True
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
neon-utils~=1.5
ovos_utils~=0.0.28
ovos_utils~=0.0,>=0.0.28
ovos-workshop~=0.0.15
2 changes: 1 addition & 1 deletion skill.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"python": [
"neon-utils~=1.5",
"ovos-workshop~=0.0.15",
"ovos_utils~=0.0.28"
"ovos_utils~=0.0,>=0.0.28"
],
"system": {},
"skill": []
Expand Down
3 changes: 1 addition & 2 deletions test/test_skill.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@

from os.path import dirname
from mock import Mock
from mycroft_bus_client import Message
from neon_utils.skills import NeonFallbackSkill
from ovos_bus_client.message import Message

from neon_minerva.tests.skill_unit_test_base import SkillTestCase

Expand Down
2 changes: 1 addition & 1 deletion version.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

__version__ = "2.0.0"
__version__ = "2.0.1"
Loading