Firefox OS/Vaani/Custom Command: Difference between revisions

implementation update, development plan update
(implementation update, development plan update)
Line 14: Line 14:
= Implementation =
= Implementation =
(TBD)(brief introduction)
(TBD)(brief introduction)
== Architecture ==
To achieve 3rd party command registry, we apply linked data defined in schema.org as command format then make Vaani parse and manage the registered commands.
(TBD)(graph and explain)
 
The following picture shows the system architecture :
[[image:CustomerCommandArchitecture.png|none|thumb|500px|]]
We will explain this architecture by components.
===ActionCollector===
ActionCollector will parse the actions from ActionDescriptions and store it. Once it receives the action trigger event, it will forward the action to corresponding web app.
===InteractionManager===
InteractionManager is the main controller of this system. It listens to the recognition results from SpeechRecognition and ask ActionCollector to trigger related action.
===ActionTranslater===
When InteractionManager receives the recognition results from SpeechRecognition, what it gets is just the raw sentences. The results have to be translated by ActionTranslater to become real action.
===Vaani===
Vaani is the UI of this system, it will tell users the state of this system and also user interact with users to make them get access to this system.
<br><br>
Our ultra target is use JSON-LD format to implement actions, this will be mentioned in the following section.
And in current stage, we don't implement ActionTranslater neither, just register predefined grammar to SpeechRecognition.


== Data structure ==
== Data structure ==
Line 54: Line 38:


In this case, we create a dial command whose object is a telephone text or a person. Once a user says this command, the '''/dailer/index.html?dail={telephone}''' is called.
In this case, we create a dial command whose object is a telephone text or a person. Once a user says this command, the '''/dailer/index.html?dail={telephone}''' is called.
== Structure of Code==
<br>
[[image:Introduced-modules.png|none|thumb|500px|]]
==== predefined actions (predefined-actions/*.js) ====
A predefined action is responsible for:
* parse target field of manifest.webapp
* generate grammar
* parse result from transcript
We can find DialAction at predefined-actions/dial-action.js, OpenAppAction at predefined-actions/open-app-action.js.
==== launchers (launchers/*.js) ====
A launcher executes the command parsed by Vaani. Currently, we only support '''WebActivity''', launchers/activity-launcher.js. In the future, we will support IAC.
==== actions parser (store/app-actions.js) ====
The actions parser parses action definitions from manifest.webapp. It looks up custom_command field from manifest.webapp file. Once found it, it asks launcher to parse it.
==== core (action/standing-by.js) ====
We extends the original design of Vaani but changes '''setupSpeech''' and '''_interpreter''' function at standing-by.js:
* '''setupSpeech''': we use predefined actions to generate grammars.
* '''_interpreter''': we use predefined actions to parse transcript and use launcher to execute command.


=== Predefined actions ===
=== Predefined actions ===
(TBD)
(TBD)
==== Dial Action ====
      "custom_commands": [{
        "@context": "http://schema.org",
        "@type": "DialAction",
        "target": {
          "@type": "WebActivity",
          "name": "dial",
          "data": {
            "type": "webtelephony/number",
            "number": "@number"
          }
        }
      }]
==== Open Action ====
      "custom_commands": [{
        "@context": "http://schema.org",
        "@type": "OpenAction",
        "object": "SoftwareApplication",
        "target": {
          "@type": "WebActivity",
          "name": "open-app",
          "data": {
            "type": "webapp",
            "manifest": "@manifest",
            "entry_point": "@entry_point"
          }
        }
      }]


== Bug list ==
== Bug list ==
Line 67: Line 107:
**Define data format and supported actions.
**Define data format and supported actions.
**Predefined grammar structure.
**Predefined grammar structure.
**Single command.
**Compound command through IAC.
*Stage 2 : Compound command
*Stage 2 : Compound command API
**Compound command.
**Compound command API for 3rd party apps.
*Stage 3 : NLP service
*Stage 3 : NLP service
**NLP processor to recognition result.
**NLP processor to recognition result.
Line 143: Line 183:
Since there is no one handles open-app activity, we also add open-app activity to Vaani app.
Since there is no one handles open-app activity, we also add open-app activity to Vaani app.


=== Structure of Code===
== Stage 2 ==
 
In stage 1, we use IAC to achieve interaction between Vaani and app. However, IAC is only for certified apps, we want extend it to any 3rd party apps. So in this stage, we will design a communication API for general packaged apps.
[[image:Introduced-modules.png|none|thumb|500px|]]
 
==== predefined actions (predefined-actions/*.js) ====
A predefined action is responsible for:
* parse target field of manifest.webapp
* generate grammar
* parse result from transcript
 
We can find DialAction at predefined-actions/dial-action.js, OpenAppAction at predefined-actions/open-app-action.js.
 
 
==== launchers (launchers/*.js) ====
A launcher executes the command parsed by Vaani. Currently, we only support '''WebActivity''', launchers/activity-launcher.js. In the future, we will support IAC.
 
 
==== actions parser (store/app-actions.js) ====
The actions parser parses action definitions from manifest.webapp. It looks up custom_command field from manifest.webapp file. Once found it, it asks launcher to parse it.
 
 
==== core (action/standing-by.js) ====
We extends the original design of Vaani but changes '''setupSpeech''' and '''_interpreter''' function at standing-by.js:
* '''setupSpeech''': we use predefined actions to generate grammars.
* '''_interpreter''': we use predefined actions to parse transcript and use launcher to execute command.


= FAQ =
= FAQ =
110

edits