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

[SV] Locks sentences #2395

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft

[SV] Locks sentences #2395

wants to merge 5 commits into from

Conversation

frli4797
Copy link

@frli4797 frli4797 commented Sep 25, 2024

Basic sentences for locks in Swedish.

Summary by CodeRabbit

  • New Features

    • Added Swedish language responses for locking and unlocking actions.
    • Introduced intents for controlling locks, allowing users to lock/unlock specific doors or all doors in an area.
    • Expanded recognition of lock states and related terms in Swedish.
  • Tests

    • Added test cases to validate the new locking and unlocking intents in Swedish.

Copy link

@home-assistant home-assistant bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @frli4797

It seems you haven't yet signed a CLA. Please do so here.

Once you do that we will be able to review and accept this pull request.

Thanks!

@home-assistant
Copy link

Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍

Learn more about our pull request process.

Copy link

coderabbitai bot commented Sep 25, 2024

📝 Walkthrough
📝 Walkthrough
📝 Walkthrough
📝 Walkthrough

Walkthrough

The changes include the addition of new responses and intent definitions for locking and unlocking mechanisms in Swedish. Specifically, new entries for the lock action have been added to response files, and new intent files have been created to handle user commands related to locking and unlocking specific doors or all locks in designated areas. Additionally, test cases have been introduced to validate these intents and responses, along with new areas and entities for testing purposes.

Changes

Files Change Summary
responses/sv/HassTurnOff.yaml Added response: lock: "Låste upp" for the lock action.
responses/sv/HassTurnOn.yaml Added response: lock: "Låste" for the lock action.
sentences/sv/_common.yaml Added entries under lock_states and expansion_rules for handling lock states and terms.
sentences/sv/lock_HassTurnOff.yaml Introduced HassTurnOff intent with sentence patterns for unlocking locks.
sentences/sv/lock_HassTurnOn.yaml Introduced HassTurnOn intent with sentence patterns for locking items.
tests/sv/_fixtures.yaml Added new area "Hallen" and entities "Ytterdörren" and "Bakdörren" associated with it.
tests/sv/lock_HassTurnOff.yaml Added test cases for HassTurnOff intent with scenarios for unlocking specific and all locks.
tests/sv/lock_HassTurnOn.yaml Added test cases for HassTurnOn intent with scenarios for locking specific and all doors.

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai or @coderabbitai title anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 6

🧹 Outside diff range and nitpick comments (8)
responses/sv/HassTurnOn.yaml (1)

12-12: LGTM! Consider adding area-specific lock response.

The addition of the Swedish response for the lock action is correct and aligns well with the existing structure. The translation "Låste" (Locked) is appropriate for the HassTurnOn intent in the context of locks.

For consistency with other entries like lights_area and cover_area, consider adding an area-specific response for locks. This could be useful for scenarios where you want to indicate locking all doors in a specific area. For example:

lock_area: "Låste i {{ slots.area }}"

This addition would provide more flexibility in responses related to locking actions.

sentences/sv/lock_HassTurnOn.yaml (1)

12-18: LGTM: Second intent structure is well-designed with a suggestion.

The second intent structure is well-designed:

  • It provides flexible sentence patterns for locking all or specific items in an area.
  • The use of slots for domain and name is appropriate.
  • It allows for locking multiple items with the "alla" (all) option.

Consider adding a comment explaining the meaning of "låsbar" and "i_på" for non-Swedish speakers, to improve code readability. For example:

# låsbar: lockable items (e.g., doors, windows)
# i_på: prepositions "in" or "on"
sentences/sv/lock_HassTurnOff.yaml (2)

4-10: LGTM: Well-structured intent definition with a suggestion for improvement.

The first set of sentences for the HassTurnOff intent is well-defined. It correctly allows for unlocking a specific lock by name, with an optional area specification. The context requirement and response type are appropriately set.

Consider adding a comment to explain the use of "i_på" for non-Swedish speakers. For example:

sentences:
  # "i_på" covers both "in" and "on" prepositions in Swedish
  - "lås upp <name>[ i_på <area>]"

11-17: LGTM: Comprehensive intent definition with a suggestion for consistency.

The second set of sentences for the HassTurnOff intent is well-defined. It provides flexible options for unlocking all locks or specific locks, with or without area specification. The domain and name slots are correctly set.

For consistency with the first set of sentences, consider using the same optional area syntax:

sentences:
  - "lås upp [<alla>] <låsbar>[ i_på <area>]"
  - "lås upp [<alla>] <låsbar>"

This change would make the area specification optional in the first pattern, matching the style of the earlier definition.

tests/sv/lock_HassTurnOff.yaml (1)

3-11: Consider intent naming and response customization.

The test case is well-structured, but there are two points to consider:

  1. The intent name HassTurnOff doesn't seem intuitive for unlocking. Consider using a more specific name like HassUnlock to improve clarity.

  2. The response "Låste upp" is correct, but it might be more natural to include the name of the door. For example: "Låste upp Ytterdörren".

Could you clarify the reasoning behind using HassTurnOff for unlocking? If it's a project-wide convention, please disregard the first point.

tests/sv/lock_HassTurnOn.yaml (1)

1-23: Overall good structure with room for improvement

The file successfully defines test scenarios for Swedish lock-related intents with a clear and consistent structure. The multiple sentence variations in the second scenario provide good coverage for different phrasings, which is commendable.

However, there are a few areas for improvement that apply to both scenarios:

  1. Intent naming: Consider renaming "HassTurnOn" to a more specific name like "HassLock" or "HassDoorLock" to better reflect the locking action.
  2. Response enhancement: The responses could be more informative by including context (e.g., the door or area being locked).
  3. Slot usage: Review the necessity and clarity of the "name: alla" slot in the second scenario.

Addressing these points will enhance the clarity, consistency, and informativeness of the tests.

tests/sv/_fixtures.yaml (1)

98-103: LGTM: New lock entities added correctly

The new lock entities "Ytterdörren" (Front door) and "Bakdörren" (Back door) are added correctly, following the existing structure and naming conventions. They are appropriately associated with the new "hallen" area, which is consistent with typical home layouts.

Consider adding a state property to these new entities for consistency with other entities in the file. For example:

  - name: Ytterdörren
    id: lock.ytterdorren
    area: hallen
    state:
      in: "låst"
      out: "locked"

This addition would provide more comprehensive test fixtures for lock states in Swedish.

sentences/sv/_common.yaml (1)

344-344: LGTM: Comprehensive lock-related expansion rule added

The new låsbar expansion rule effectively covers a wide range of lock-related terms in Swedish, including locks, doors, windows, gates, and garage doors. This addition significantly enhances the system's ability to recognize and process lock-related commands in various contexts.

For consistency with other entries in the expansion_rules section, consider adding a colon after låsbar:

-  låsbar: "(lås[en]|dörr[ar|en|arna]|fönster|grind[ar|en|arna]|garagedörr[ar|en|arna])"
+  låsbar: ":(lås[en]|dörr[ar|en|arna]|fönster|grind[ar|en|arna]|garagedörr[ar|en|arna])"

This minor change would align the låsbar entry with the format used in other expansion rules like name: and area:.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between f2f3bdc and 428f151.

📒 Files selected for processing (8)
  • responses/sv/HassTurnOff.yaml (1 hunks)
  • responses/sv/HassTurnOn.yaml (1 hunks)
  • sentences/sv/_common.yaml (2 hunks)
  • sentences/sv/lock_HassTurnOff.yaml (1 hunks)
  • sentences/sv/lock_HassTurnOn.yaml (1 hunks)
  • tests/sv/_fixtures.yaml (2 hunks)
  • tests/sv/lock_HassTurnOff.yaml (1 hunks)
  • tests/sv/lock_HassTurnOn.yaml (1 hunks)
🔇 Additional comments not posted (11)
responses/sv/HassTurnOff.yaml (2)

Line range hint 1-12: Overall file structure and format look good

The overall structure and format of the file are consistent and well-organized. The YAML syntax is correct, and the indentation is properly maintained throughout the file.

Good job on maintaining a clean and readable configuration file. This consistency will make it easier for other contributors to understand and modify the responses in the future.


Line range hint 1-12: Verify consistent handling of lock/unlock actions across the system

While we've addressed the immediate inconsistency in the 'lock' response, it's important to ensure that lock/unlock actions are handled consistently across the entire system.

Please verify the following:

  1. Check if there's a corresponding HassTurnOn.yaml file for "turn on" actions, which should include the unlocking response.
  2. Ensure that both locking and unlocking actions are properly represented in their respective files.

Run the following script to help with this verification:

This will help ensure that lock/unlock actions are handled consistently and correctly across different intents in the Swedish language responses.

✅ Verification successful

Verification Successful: Lock/Unlock actions are consistently handled across the system.

All necessary lock-related responses are present in both HassTurnOn.yaml and HassTurnOff.yaml, ensuring consistent handling of locking and unlocking actions.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for HassTurnOn.yaml and verify lock-related entries

# Test 1: Check if HassTurnOn.yaml exists
echo "Checking for HassTurnOn.yaml:"
fd -p "responses/sv/HassTurnOn.yaml"

# Test 2: If it exists, check for lock-related entries in both files
echo -e "\nChecking for lock-related entries in both files:"
rg -i "lock:" responses/sv/HassTurnOn.yaml responses/sv/HassTurnOff.yaml

# Test 3: Check for any other files that might contain lock-related responses
echo -e "\nChecking for other files with lock-related responses:"
rg -i "lock:" responses/sv/

Length of output: 677

sentences/sv/lock_HassTurnOn.yaml (2)

5-10: LGTM: First intent structure is well-defined.

The first intent structure is well-defined:

  • It allows locking a specific item with an optional area specification.
  • The context requirement ensures it's only used for locks.
  • The response is appropriately set to "lock".

This structure provides good flexibility for users to lock specific items.


1-18: Overall: Well-structured intents with room for future enhancements.

The file successfully defines intents for locking items in Swedish, providing good coverage for common use cases. The structures are flexible and should accommodate various user phrasings.

For future enhancements, consider:

  1. Adding more variations of locking commands if needed (e.g., time-based locking).
  2. Including examples in comments to illustrate how each intent would be used.
  3. Ensuring consistency with unlocking intents (if they exist or will be added later).

Great job on implementing these basic sentences for locks in Swedish!

sentences/sv/lock_HassTurnOff.yaml (2)

1-3: LGTM: Correct language declaration and intent structure.

The file header correctly declares the language as Swedish (sv) and properly initiates the intents section with HassTurnOff. This follows the expected YAML format for intent definitions.


1-17: Overall: Well-implemented intent definitions for unlocking locks in Swedish.

This new file successfully introduces intent definitions for unlocking locks in Swedish. The implementation provides good flexibility with options for unlocking specific locks, all locks, and with or without area specifications. The YAML structure is correct, and the intent definitions are clear and functional.

The minor suggestions provided earlier for adding a comment and adjusting syntax for consistency would further enhance the file, but the current implementation is already of high quality and fit for purpose.

tests/sv/lock_HassTurnOff.yaml (1)

1-2: LGTM: File header is correct.

The language specification and tests section are properly defined.

tests/sv/_fixtures.yaml (2)

13-14: LGTM: New area "Hallen" added correctly

The new area "Hallen" (Hall) is added following the existing structure and naming conventions. This addition is relevant for lock-related fixtures and enhances the test coverage for Swedish language support.


13-14: Summary: Effective addition of lock-related test fixtures

The changes in this file effectively enhance the Swedish language test fixtures by adding a new area "Hallen" and two lock entities "Ytterdörren" and "Bakdörren". These additions are well-structured, follow existing conventions, and directly support the PR objective of introducing basic sentences for locks in Swedish.

The new fixtures will improve test coverage for lock-related functionalities in the Swedish language context, contributing to better localization and user experience for Swedish-speaking users.

Also applies to: 98-103

sentences/sv/_common.yaml (2)

69-74: LGTM: Lock states correctly defined in Swedish

The added lock_states section accurately maps Swedish lock-related terms to their English equivalents. This addition aligns well with the PR objective of introducing basic sentences for locks in Swedish.

  • "[säkert ]låst" → "locked" (allows for both "låst" and "säkert låst")
  • "upplåst" → "unlocked"

These mappings will enable proper interpretation of lock-related commands and status reports in Swedish.


69-74: Summary: Excellent additions for Swedish lock-related language support

The changes in this file successfully introduce basic sentences and terms for locks in Swedish, aligning perfectly with the PR objectives. The additions include:

  1. Accurate mappings for lock states (locked and unlocked) in the lock_states section.
  2. A comprehensive expansion rule for various lock-related terms in the expansion_rules section.

These changes will significantly enhance the system's ability to understand and process lock-related commands in Swedish. The implementation is thorough and well-thought-out, covering a wide range of scenarios and terms.

Great job on improving language support for Swedish users!

Also applies to: 344-344

responses/sv/HassTurnOff.yaml Show resolved Hide resolved
sentences/sv/lock_HassTurnOn.yaml Show resolved Hide resolved
Comment on lines 12 to 21
- sentences:
- "lås upp alla lås i hallen"
- "Lås upp dörren i hallen"
intent:
name: HassTurnOff
slots:
area: Hallen
domain: lock
name: alla
response: "Låste upp"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Improve consistency and specificity in the second test case.

There are several points to address in this test case:

  1. The two test sentences have different meanings (all locks vs. the door), but they use the same slots and response. Consider splitting this into two separate test cases.

  2. The name slot is set to "alla" (all) which doesn't match the second sentence about a specific door. Update this to accurately reflect each test sentence.

  3. The response "Låste upp" doesn't indicate whether it's unlocking all locks or a specific door. Consider making the response more specific, e.g., "Låste upp alla lås i Hallen" or "Låste upp dörren i Hallen".

  4. The capitalization in the test sentences is inconsistent. Standardize the capitalization, preferably starting each sentence with a capital letter.

Here's a suggested restructure:

  - sentences:
      - "Lås upp alla lås i hallen"
    intent:
      name: HassTurnOff
      slots:
        area: Hallen
        domain: lock
        name: alla
    response: "Låste upp alla lås i Hallen"

  - sentences:
      - "Lås upp dörren i hallen"
    intent:
      name: HassTurnOff
      slots:
        area: Hallen
        domain: lock
        name: dörren
    response: "Låste upp dörren i Hallen"

This structure separates the two cases, uses appropriate slot values, and provides more specific responses.

tests/sv/lock_HassTurnOff.yaml Outdated Show resolved Hide resolved
tests/sv/lock_HassTurnOn.yaml Show resolved Hide resolved
tests/sv/lock_HassTurnOn.yaml Outdated Show resolved Hide resolved
@frli4797 frli4797 changed the title Locks sentences for sv/SE [SE] Locks sentences Sep 25, 2024
@frli4797 frli4797 changed the title [SE] Locks sentences [SV] Locks sentences Sep 25, 2024
Copy link
Contributor

@larsdunemark larsdunemark left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to update the all slot name.

- "lås upp [<alla>] <area> <låsbar>"
slots:
domain: "lock"
name: "alla"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would expect that this sentence should set the name to "all" and not "alla". Since it is not translated slot name.
Looking at DE and ES languages for example.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh. My bad. Fixed in latest commit.

@home-assistant home-assistant bot marked this pull request as draft September 30, 2024 21:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants