|
| 1 | +<?xml version="1.0" encoding="utf-8"?> |
| 2 | +<!-- |
| 3 | +This file contains the regular expressions patterns used for figuring out what action the user wishes to take. When |
| 4 | +adding translations, please do not modify (.*), $1, ([0-9]+), etc. |
| 5 | +--> |
| 6 | +<resources> |
| 7 | + <!-- |
| 8 | + This pattern is the main pattern that will need to be matched in order for anything to be done. As you can see it is |
| 9 | + a quite complicated regular expression. Plugging it into https://www.debuggex.com/ should help you figure out how |
| 10 | + it is constructed. |
| 11 | + --> |
| 12 | + <item name="pattern_recognition" type="string">^(((watch|resume watching|listen to|watch movie) (.+)( on (.+))?( on shuffle)?)|((offset|timecode) (.+)( on (.+))?)|((pause|stop|resume) playback( on (.+))?))|(connect to (.+)|disconnect)$</item> |
| 13 | + |
| 14 | + <item name="pattern_on_client" type="string">(.+) on (.+)$</item> |
| 15 | + <item name="pattern_resume_watching" type="string">^resume watching (.+)</item> |
| 16 | + <item name="pattern_on_shuffle" type="string"> on shuffle$</item> |
| 17 | + <item name="pattern_watch" type="string">watch $1</item> |
| 18 | + <item name="pattern_watch_movie" type="string">watch movie (.+)</item> |
| 19 | + <item name="pattern_watch_season_episode_of_show" type="string">watch season ([0-9]+) episode ([0-9]+) of (.+)</item> |
| 20 | + <item name="pattern_watch_show_season_episode" type="string">watch (.+) season ([0-9]+) episode ([0-9]+)</item> |
| 21 | + <item name="pattern_watch_episode_of_show" type="string">watch episode (.+) of (.+)</item> |
| 22 | + <item name="pattern_watch_next_episode_of_show" type="string">watch the next episode of (.+)</item> |
| 23 | + <item name="pattern_watch_latest_episode_of_show" type="string">watch( the)? latest episode of (.+)</item> |
| 24 | + <item name="pattern_watch_show_episode_named" type="string">watch (.+) episode (.+)</item> |
| 25 | + <item name="pattern_connect_to" type="string">^connect to (.+)</item> |
| 26 | + <item name="pattern_disconnect" type="string">^disconnect$</item> |
| 27 | + <item name="pattern_watch2" type="string">watch (.+)</item> |
| 28 | + |
| 29 | + <!-- |
| 30 | + The following pattern lets the user say "listen to <album> by <artist>" or |
| 31 | + "listen to the album <album> by <artist>". |
| 32 | + --> |
| 33 | + <item name="pattern_listen_to_album_by_artist" type="string">listen to the album (.+) by (.+)</item> |
| 34 | + |
| 35 | + <item name="pattern_listen_to_album" type="string">listen to the album (.+)</item> |
| 36 | + <item name="pattern_listen_to_song_by_artist" type="string">listen to (.+) by (.+)</item> |
| 37 | + |
| 38 | + <item name="pattern_pause_playback" type="string">pause playback</item> |
| 39 | + <item name="pattern_resume_playback" type="string">resume playback</item> |
| 40 | + <item name="pattern_stop_playback" type="string">stop playback</item> |
| 41 | + |
| 42 | + <!-- |
| 43 | + The following are used in conjunction with the pattern_offset below. These should match the |
| 44 | + (hours?minutes?seconds?), with the addition of the ^ character (to indicate that in the matching |
| 45 | + pattern group starts with (hours or minutes or seconds). Unreliable behavior may result if |
| 46 | + these to not match the corresponding groups in pattern_offset. |
| 47 | + --> |
| 48 | + <item name="pattern_hours" type="string">^hours?</item> |
| 49 | + <item name="pattern_minutes" type="string">^minutes?</item> |
| 50 | + <item name="pattern_seconds" type="string">^seconds?</item> |
| 51 | + |
| 52 | + <!-- |
| 53 | + Offset pattern. This lets the user start with with "offset" or "timecode", followed by: |
| 54 | + any number followed by "hour(s)" or "minute(s)" or "second(s)", and optionally followed by: |
| 55 | + any number followed by "minute(s)" or "second(s)", and optionally followed by: |
| 56 | + any number followed by "second(s)" |
| 57 | + The ([0-9]+|two|to) pattern will most likely only need to be ([0-9]+) for other languages, as in English, |
| 58 | + the number 2 sounds the same as "to" and "two", so sometimes the Voice Recognition engine will confuse the |
| 59 | + number 2 with "to" or "two". If your language has numbers that sound exactly like other words that the |
| 60 | + Voice Recognition will sometimes mis-translate, please contact Chris Bellew as some further changes will need |
| 61 | + to be made to the code to accommodate this. |
| 62 | +
|
| 63 | + The (hours?|minutes?|seconds?) means hour, with or without an s at the end (singular or plural), and the |
| 64 | + same for minutes and seconds (the | means "or"). |
| 65 | + --> |
| 66 | + <item name="pattern_offset" type="string">^(offset|timecode) ([0-9]+|two|to) (hours?|minutes?|seconds?)(?: ([0-9]+|two|to) (minutes?|seconds?))?(?: ([0-9]+|two|to) (seconds?))?</item> |
| 67 | +</resources> |
0 commit comments