I am in the process of writing a rule that does some naturral voice processing and so far the only issue I have found is my own knowledge of the openhab syntax. I am getting better though and I am confident I will be finished soon.
After alot of thought I found there are 2 ways you can go about it - naming convention wise
You can name everything however you want with short names and such - but you will need a hashmap that stores tags or a more explanatory name.
For instance you could name things FF_Lights, and SF_Lights - but you will need a hashmap and some ifs to change those too first_floor_lights and second_floor_lights respectively.
The second option I see is the one I am using, very explanatory names, I believe it is a recommendation in the wiki as well.
Lets say I have a group - upstairs - any groups within that group will be prefixed with upstairs
so that would make upstairs ->upstairs_lights, upstairs_bedroom_one, upstairs_kitchen
then any items or groups within those would would also follow that concept.
As an example my bedroom light is upstairs_bedroom_one_light
The reason I have gone with this convention is the rule I am making for processing.
- receive voice command
- strip out filler words - mostly for speed - store original if needed later
- go through all TOP LEVEL groups for each word in the command, each group gets a point for each word of the voice command it contains
- the group, or groups that have the most points get searched the same and given points
- ALL the groups from that last search get checked against each word in the command, a point for each word it contains
- at this point it is searching an item named something like upstairs_bedroom_one_secondary_light
- if there is more than one match they are stored in an array list and read back *not sure how ill do that
- if there is only one match then we have now found the item to perform an action on
- I then use something like the voice control rule in the wiki to extract the action - off/on/up/down/percent/etc
At the moment my issue is my knowledge of the language, I keep having variables overwritten and null values pop up, otherwise, with simple commands where there are no timing issues it seems to work very well. I figure every time a command is figured it will be stored in a map to make the process faster each and every time. Sorry for the rant, hope it gives you some ideas of how to proceed.