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

[ja] new language (add japanese) #2292

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

coolbiz
Copy link

@coolbiz coolbiz commented Jul 9, 2024

Thank you for providing such a great system.

I have created a part of Japanese "intents".
The test results are also attached for your consideration for registration.

===== For those who use Japanese =====(日本語環境を使われる方へ)
In this case, only the basic operation of lights and switches is created and checked.
Please refer to it and brush up.
今回はライトやスイッチの基本動作だけ作成・確認しています。
参考にしていただき、ブラッシュアップをよろしくお願いします。

<<faster-whisperの認識について>>
・tiny-int8(Beamsize:未定)では
   発声の問題もありますが、以下のような変換となり、うまく機能しないことが多発
   「ライト2を切って」===>「ライトにお置きて」
     対策1:エリアスに「ライト2」だけでなく「ライトに」を追加
         「1」も「いち」になることがあるため数字には注意
     対策2:「ライト2 オフ」などエンティティと指示だけの発声にする
・base-int8(Beamsize:10)では(私の環境)
   「ライト2を切って」===>「ライトにをきって」
     ※かなり認識が改善され、ほぼ問題なく機能しますが、
      私のRPi5環境では判定には2~3秒かかります
・small-int8(Beamsize:1)では
   「ライト2を切って」===>「ライト2をきって」
     ※概ね正しく認識されますが
      私のRPi5環境では判定には8~9秒かかり、ちょっと遅すぎる感じです

※認識時間はnucであれば早いとの情報もありますが、環境がないのでテストしていません。

idle light1

all_light living_light

Summary by CodeRabbit

  • New Features

    • Introduced Japanese language support across various Home Assistant intents, including turning on/off devices, setting light brightness and color, and executing scripts.
    • Added specific test cases and configurations for Japanese language support in home automation responses.
  • Enhancements

    • Updated leadership entries for French and Italian sections, including the removal and addition of leaders.

Copy link

coderabbitai bot commented Jul 9, 2024

Walkthrough

Walkthrough

The changes introduce Japanese language support across various configuration files, adding new entries and test cases for Home Assistant automation intents like turning on/off devices and setting light properties. Adjustments include modifying leader entries in French and Italian sections, consolidating and expanding multilingual support with specific syntax and response patterns for the Japanese language.

Changes

Files Change Summaries
languages.yaml Updated French and Italian leader entries; added Japanese language entry.
responses/ja/HassLightSet.yaml Added Japanese responses for setting brightness and color in Home Assistant lights.
responses/ja/HassTurnOff.yaml Added Japanese responses for turning off devices in a home automation system.
responses/ja/HassTurnOn.yaml Added Japanese responses for turning on home automation system entities.
sentences/ja/_common.yaml Introduced Japanese error responses, state values, context expansion rules, and timer commands.
sentences/ja/homeassistant_HassTurnOff.yaml Added Japanese phrases for turning off entities in Home Assistant, with domain-specific contexts.
sentences/ja/homeassistant_HassTurnOn.yaml Added Japanese phrases for turning on various entities, with domain-specific contexts.
sentences/ja/light_HassLightSet.yaml Added Japanese patterns for setting light brightness and color in different contexts.
sentences/ja/light_HassTurnOff.yaml Added Japanese commands for turning off lights in various contexts.
sentences/ja/light_HassTurnOn.yaml Added Japanese commands for turning on lights in various contexts.
sentences/ja/script_HassTurnOn.yaml Added Japanese commands for executing scripts in Home Assistant.
tests/ja/_fixtures.yaml Added configurations for entities like lights, switches, fans, and LEDs with IDs and states.
tests/ja/homeassistant_HassTurnOff.yaml Added test cases for turning off specific switches in Japanese.
tests/ja/homeassistant_HassTurnOn.yaml Added test cases for turning on switches in Japanese.
tests/ja/light_HassLightSet.yaml Added Japanese tests for setting LED brightness and color.
tests/ja/light_HassTurnOff.yaml Added Japanese commands for turning off lights in various contexts.
tests/ja/light_HassTurnOn.yaml Added Japanese commands for turning on lights, handling different contexts.
tests/ja/script_HassTurnOn.yaml Added test cases for executing scripts using the HassTurnOn intent in Japanese.

Sequence Diagram(s)

  • Silently ignored due to the nature of changes (adding new language support) not requiring changes to control flow or inter-component interactions.

Recent review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE

Commits

Files that changed from the base of the PR and between 0b3065d and 0722cf2.

Files selected for processing (18)
  • languages.yaml (2 hunks)
  • responses/ja/HassLightSet.yaml (1 hunks)
  • responses/ja/HassTurnOff.yaml (1 hunks)
  • responses/ja/HassTurnOn.yaml (1 hunks)
  • sentences/ja/_common.yaml (1 hunks)
  • sentences/ja/homeassistant_HassTurnOff.yaml (1 hunks)
  • sentences/ja/homeassistant_HassTurnOn.yaml (1 hunks)
  • sentences/ja/light_HassLightSet.yaml (1 hunks)
  • sentences/ja/light_HassTurnOff.yaml (1 hunks)
  • sentences/ja/light_HassTurnOn.yaml (1 hunks)
  • sentences/ja/script_HassTurnOn.yaml (1 hunks)
  • tests/ja/_fixtures.yaml (1 hunks)
  • tests/ja/homeassistant_HassTurnOff.yaml (1 hunks)
  • tests/ja/homeassistant_HassTurnOn.yaml (1 hunks)
  • tests/ja/light_HassLightSet.yaml (1 hunks)
  • tests/ja/light_HassTurnOff.yaml (1 hunks)
  • tests/ja/light_HassTurnOn.yaml (1 hunks)
  • tests/ja/script_HassTurnOn.yaml (1 hunks)
Additional comments not posted (33)
responses/ja/HassLightSet.yaml (1)

1-6: Correct language and intent structure.

The structure and responses for HassLightSet intent are correctly formatted and contextually accurate.

responses/ja/HassTurnOff.yaml (1)

1-7: Correct language and intent structure.

The structure and responses for HassTurnOff intent are correctly formatted and contextually accurate.

responses/ja/HassTurnOn.yaml (1)

1-8: Correct language and intent structure.

The structure and responses for HassTurnOn intent are correctly formatted and contextually accurate.

sentences/ja/script_HassTurnOn.yaml (1)

1-11: Correct language and intent structure.

The structure and sentences for HassTurnOn intent for script execution are correctly formatted and contextually accurate.

tests/ja/script_HassTurnOn.yaml (1)

1-13: Ensure the completeness of test cases.

The test cases cover a good range of variations for script execution commands in Japanese. Ensure that all possible variations and edge cases are covered.

Verification successful

The test cases for script execution commands in Japanese are comprehensive.

The variations present in the tests/ja/script_HassTurnOn.yaml file cover a broad range of script execution commands, ensuring completeness.

  • tests/ja/script_HassTurnOn.yaml: Lines 1-13
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the completeness of test cases for script execution commands in Japanese.

# Test: Check for all possible variations of script execution commands.
rg --type yaml 'スクリプトSW1' tests/ja/script_HassTurnOn.yaml

Length of output: 285


Script:

#!/bin/bash
# Description: Verify the completeness of test cases for script execution commands in Japanese.

# Test: Check for other potential variations of script execution commands in the tests/ja directory.
rg --type yaml 'スクリプト' tests/ja/

Length of output: 475

tests/ja/homeassistant_HassTurnOn.yaml (1)

1-18: Ensure the completeness of test cases.

The test cases cover a good range of variations for turning on switches in Japanese. Ensure that all possible variations and edge cases are covered.

sentences/ja/homeassistant_HassTurnOn.yaml (1)

1-20: Ensure the completeness and accuracy of sentence patterns.

The sentence patterns cover a good range of variations for turning on switches in Japanese. Ensure that all possible variations and edge cases are covered.

Verification successful

The regex search confirms that the sentence pattern includes the specified variations for turning on switches: "つけて", "付けて", "いれて", "入れて", and "オン". To ensure completeness, consider if there are any additional common variations or edge cases in Japanese commands for turning on switches. If no additional patterns are identified, the current patterns can be verified as complete.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the completeness and accuracy of sentence patterns for turning on switches in Japanese.

# Test: Check for all possible variations of turning on switches commands.
rg --type yaml 'つけて|付けて|いれて|入れて|オン' sentences/ja/homeassistant_HassTurnOn.yaml

Length of output: 142

sentences/ja/homeassistant_HassTurnOff.yaml (1)

1-20: Ensure consistency in context exclusions.

The excludes_context section lists several domains, including light and script. Verify that these exclusions are intentional and consistent with other language files.

tests/ja/_fixtures.yaml (1)

1-43: Ensure entity IDs are unique and correctly formatted.

Verify that all entity IDs are unique and follow the correct format (e.g., light.light1, switch.switch1).

sentences/ja/light_HassTurnOn.yaml (1)

1-33: Ensure consistency in context exclusions.

The excludes_context section lists several domains, including switch and fan. Verify that these exclusions are intentional and consistent with other language files.

sentences/ja/light_HassTurnOff.yaml (1)

1-33: Ensure consistency in context exclusions.

The excludes_context section lists several domains, including switch and fan. Verify that these exclusions are intentional and consistent with other language files.

sentences/ja/light_HassLightSet.yaml (3)

1-18: LGTM!

The sentences for setting brightness in the HassLightSet intent are well-formed and contextually accurate.


20-25: LGTM!

The sentences for setting max/min brightness in the HassLightSet intent are well-formed and contextually accurate.


27-32: LGTM!

The sentences for setting color in the HassLightSet intent are well-formed and contextually accurate.

tests/ja/light_HassTurnOn.yaml (4)

1-13: LGTM!

The test cases for turning on a single light are well-formed and contextually accurate.


14-23: LGTM!

The test cases for turning on a light in a specific area are well-formed and contextually accurate.


24-38: LGTM!

The test cases for turning on all lights in an area are well-formed and contextually accurate.


39-47: LGTM!

The test cases for turning on all lights are well-formed and contextually accurate.

tests/ja/light_HassTurnOff.yaml (4)

1-13: LGTM!

The test cases for turning off a single light are well-formed and contextually accurate.


14-23: LGTM!

The test cases for turning off a light in a specific area are well-formed and contextually accurate.


24-38: LGTM!

The test cases for turning off all lights in an area are well-formed and contextually accurate.


39-47: LGTM!

The test cases for turning off all lights are well-formed and contextually accurate.

tests/ja/light_HassLightSet.yaml (4)

1-14: LGTM!

The test cases for setting brightness are well-formed and contextually accurate.


15-26: LGTM!

The test cases for setting brightness in a specific area are well-formed and contextually accurate.


27-38: LGTM!

The test cases for setting max/min brightness are well-formed and contextually accurate.


39-49: LGTM!

The test cases for setting color are well-formed and contextually accurate.

languages.yaml (3)

103-104: LGTM! New language entry for Japanese.

The addition of the Japanese language entry is consistent with the rest of the file.


Line range hint 75-75:
Verify the addition of the Italian leaders.

Ensure that the addition of auanasgheps and xraver to the Italian section is intentional and consistent with other documentation or records.

Verification successful

The addition of the Italian leaders auanasgheps and xraver is correctly placed and structured.

  • The leaders are correctly listed under the it: section.
  • The structure is consistent with other language sections in the languages.yaml file.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the addition of the leaders `auanasgheps` and `xraver` to the Italian section.

# Test: Search for any references to `auanasgheps` and `xraver` in the repository. Expect: References to `auanasgheps` and `xraver` in the Italian section.
rg --type yaml 'auanasgheps|xraver'

Length of output: 98


Script:

#!/bin/bash
# Description: Verify the structure and placement of the Italian section and its leaders in languages.yaml

# Test: Extract the Italian section from the languages.yaml file and display its context.
rg -A 10 'it:' languages.yaml

Length of output: 175


Line range hint 49-49:
Verify the removal of the French leader.

Ensure that the removal of jlpouffier from the French section is intentional and consistent with other documentation or records.

sentences/ja/_common.yaml (4)

1-22: LGTM! Error messages for various scenarios.

The error messages in the responses section are accurate and consistent with the rest of the file.


43-269: LGTM! Values for various attributes.

The values in the lists section for color, brightness, temperature, on/off states, and binary sensor states are accurate and consistent with the rest of the file.


369-409: LGTM! Expansion rules for various scenarios.

The expansion rules in the expansion rules section for context awareness, questions, and timer-related commands are accurate and consistent with the rest of the file.


410-414: LGTM! Skip words for processing.

The skip words in the skip words section are accurate and consistent with the rest of the file.


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>.
    • 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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 as 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.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration 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: 5

Comment on lines +1 to +20
language: ja
intents:
HassTurnOff:
data:
- sentences:
- "[<area>の]<name>[を|お](けして|消して|きって|切って|オフ[に][して])"
excludes_context:
domain:
- binary_sensor
- cover
- lock
- scene
- sensor
- valve
# another intent
- light
- script
- fan
slots:
domain: switch
Copy link

Choose a reason for hiding this comment

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

Consider adding comments for clarity.

Adding comments to explain the purpose of each section (e.g., excludes_context, slots) can improve maintainability and readability.

Comment on lines +1 to +43
language: ja
areas:
- name: "リビング"
id: "living"

- name: "寝室"
id: "bedroom"

entities:
- name: "ライト1"
id: light.light1
area: "living"
state: "on"

- name: "ライト2"
id: light.light2
area: "living"
state: "on"

- name: "ライト3"
id: light.light3
area: "bedroom"
state: "on"

- name: "スイッチ1"
id: switch.switch1
area: "living"

- name: "スイッチ2"
id: switch.switch2
area: "bedroom"

- name: "スクリプトSW1"
id: script.script_sw1
area: "living"

- name: "ファン1"
id: fan.fan1
area: "living"

- name: "LED"
id: light.led
area: "bedroom"
Copy link

Choose a reason for hiding this comment

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

Consider adding comments for clarity.

Adding comments to explain the purpose of each section (e.g., areas, entities) can improve maintainability and readability.

Comment on lines +1 to +33
language: ja
intents:
HassTurnOn:
data:
- sentences:
- "[<area>の]<name>[の<light>][を|お](つけて|付けて|いれて|入れて|オン[に][して])"
excludes_context:
domain:
- switch
- fan
requires_context:
domain:
- light
slots:
domain: light

# Turn on all lights in a area
- sentences:
- "<area>の[<all>の]<light>[を|お](つけて|付けて|いれて|入れて|オン[に][して])"
excludes_context:
domain:
- switch
- fan
slots:
domain: "light"
response: "lights_area"

# Turn on all lights in the home
- sentences:
- "<all><light>[を|お](つけて|付けて|いれて|入れて|オン[に][して])"
slots:
domain: "light"
response: "light_all"
Copy link

Choose a reason for hiding this comment

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

Consider adding comments for clarity.

Adding comments to explain the purpose of each section (e.g., excludes_context, slots, response) can improve maintainability and readability.

Comment on lines +1 to +33
language: ja
intents:
HassTurnOff:
data:
- sentences:
- "[<area>の]<name>[の<light>][を|お](けして|消して|きって|切って|オフ[に][して])"
excludes_context:
domain:
- switch
- fan
requires_context:
domain:
- light
slots:
domain: light

# Turn off all lights in a area
- sentences:
- "<area>の[<all>の]<light>[を|お](けして|消して|きって|切って|オフ[に][して])"
excludes_context:
domain:
- switch
- fan
slots:
domain: light
response: "lights_area"

# Turn off all lights in the home
- sentences:
- "<all><light>[を|お](けして|消して|きって|切って|オフ[に][して])"
slots:
domain: "light"
response: "light_all"
Copy link

Choose a reason for hiding this comment

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

Consider adding comments for clarity.

Adding comments to explain the purpose of each section (e.g., excludes_context, slots, response) can improve maintainability and readability.

Comment on lines +1 to +18
language: ja
tests:
- sentences:
- "リビングのスイッチ1オフ"
intent:
name: HassTurnOff
slots:
domain: switch
name: "スイッチ1"
area: "リビング"

- sentences:
- "スイッチ2オフして"
intent:
name: HassTurnOff
slots:
domain: switch
name: "スイッチ2"
Copy link

Choose a reason for hiding this comment

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

Tip

Codebase Verification

Ensure completeness of test cases for switches

The test cases for turning off switches in tests/ja/homeassistant_HassTurnOff.yaml are limited to two variations. Consider adding more variations and edge cases similar to the comprehensive test cases for lights in tests/ja/light_HassTurnOff.yaml.

  • Add more variations for turning off switches, including different ways to phrase the command.
  • Include edge cases such as turning off all switches in an area.
Analysis chain

Ensure the completeness of test cases.

The test cases cover a good range of variations for turning off switches in Japanese. Ensure that all possible variations and edge cases are covered.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the completeness of test cases for turning off switches in Japanese.

# Test: Check for all possible variations of turning off switches commands.
rg --type yaml 'スイッチ' tests/ja/homeassistant_HassTurnOff.yaml

Length of output: 195


Script:

#!/bin/bash
# Description: Verify the completeness of test cases for turning off switches in Japanese.

# Test: Check for all instances of the "HassTurnOff" intent in the entire tests/ja directory.
rg --type yaml 'HassTurnOff' tests/ja

Length of output: 389


Script:

#!/bin/bash
# Description: Display the content of tests/ja/light_HassTurnOff.yaml to analyze additional test cases for the "HassTurnOff" intent.

cat tests/ja/light_HassTurnOff.yaml

Length of output: 894

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.

1 participant