Warning, /libraries/libqmycroft/README.md is written in an unsupported language. File is not indexed.
0001 # Libqmycroft
0002
0003 **Mycroft integration library using a mock API to integrate Qt/QML applications as dynamic skills in Mycroft Core.**
0004
0005 Libqmycroft allows QML based applications to register themselves as dynamic skills using the Libqmycroft Mock Skills Interface which eliminates the need to create specific skills for traditional applications to gain voice control over the application user interface.
0006
0007 *The library is currently limited to usage of only [Mycroft's Padatious](https://mycroft-ai.gitbook.io/docs/mycroft-technologies/padatious) intent parser framework, The library is in early development and interface/API breakage can be expected!*
0008
0009
0010
0011
0012 --------------------------------
0013
0014 - [Libqmycroft](#libqmycroft)
0015 * [Libqmycroft Requirements](#libqmycroft-requirements)
0016 * [Libqmycroft Installation](#libqmycroft-installation)
0017 * [Libqmycroft API & Usage](#libqmycroft-api---usage)
0018 - [SkillManager Class & Object](#skillmanager-class-and-object)
0019 - [SkillEntry Class & Object](#skillentry-class-and-object)
0020 - [Controller Class](#controller-class)
0021 - [Audio Transcriber Class and TranscribeButton Component](#audio-transcriber-class-and-transcribebutton-component)
0022 * [Usage Example of Libqmycroft in QML application](#usage-example-of-libqmycroft-in-qml-application)
0023 * [Usage Example of Libqmycroft AudioTranscriber in QML application](#usage-example-of-libqmycroft-audiotranscriber-in-qml-application)
0024
0025
0026 --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
0027
0028
0029
0030 ## Libqmycroft Requirements
0031
0032 - [Mycroft-Core](https://github.com/MycroftAI/mycroft-core/): Local installation of Mycroft Core. The code itself includes anything that is generic to all instances of Mycroft.
0033 - Libqmycroft: Library framework and QML Module contained in this repository and built and installed using cmake.
0034 - Libqmycroft-Mock-Skills-Interface: Mycroft Skill Interface part of this repository, requires installation into Mycroft's skill folder
0035
0036
0037
0038 ## Libqmycroft Installation
0039
0040 - Installing Mycroft-Core (git version):
0041
0042 - ```bash
0043 git clone https://github.com/MycroftAI/mycroft-core
0044 cd mycroft-core
0045 ./dev_setup.sh
0046 ```
0047
0048 - Installing Libqmycroft & Libqmycroft-Mock-Skills-Interface (installation script for Mycroft-Core git version only):
0049
0050 - ```bash
0051 git clone https://invent.kde.org/AdityaM/libqmycroft
0052 cd libqmycroft
0053 ./dev_setup.sh
0054 ```
0055
0056 - Installing Libqmycroft (manually):
0057
0058 - ```bash
0059 git clone https://invent.kde.org/AdityaM/libqmycroft
0060 cd libqmycroft
0061 mkdir build
0062 cd build
0063 cmake .. -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release -DKDE_INSTALL_LIBDIR=lib -DKDE_INSTALL_USE_QT_SYS_PATHS=ON
0064 make
0065 sudo make install
0066 ```
0067
0068 - Installing & Libqmycroft-Mock-Skills-Interface (manually):
0069
0070 - ```bash
0071 git clone https://invent.kde.org/AdityaM/libqmycroft
0072 cd libqmycroft
0073 cp -R libqmycroft-mock-interface /opt/mycroft/skills/
0074 ```
0075
0076
0077
0078 ## Libqmycroft API & Usage
0079
0080 Libqmycroft provides developers with a declarative QML API for Skill Management and Skill Registration.
0081
0082
0083
0084 ### SkillManager Class and Object
0085
0086 The SkillManager Object allows applications to manage and register a list of SkillEntry Objects, The SkillManager class also exposes functions and signals for creating the dynamic skill and listeners for intents and actions that have been invoked by voice interaction. The SkillManager class also exposes additional connection settings like setting the web socket address manually for connecting to a Mycroft-Core instance which can be used in cases of supporting remote instances or different than normal web socket address.
0087
0088 Important properties of the SkillManager Object:
0089
0090 - **skillNamespace** *(required)*: Name of the dynamic skill to register skill entries against.
0091 - **socketAddress** *(optional)*: Web Socket address of the Mycroft-Core instance. *Defaults to local mycroft-core default address*
0092
0093 Important functions of the SkillManager Object:
0094
0095 - **createSkill() Method** *(required)*: Registers dynamic skill namespace and skill entries with Libqmycroft-Mock-Skills-Interface
0096 - **deleteSkill() Method** *(optional)*: Deletes the registered skill intents and namespace registration from Libqmycroft-Mock-Skills-Interface, it is automatically called in the SkillManager class deconstructor method when parent object is destroyed. *For example: when the application window in which the SkillManager object was registered is closed*
0097
0098
0099
0100 ### SkillEntry Class and Object
0101
0102 The SkillEntry Object allows applications to create skill entries to be registered during the time of skill creation. SkillEntry Object manages entries for:
0103
0104 - **intent** *(required)*: An intent is the task the user intends to accomplish when they say something. The role of the intent parser is to extract from the user's speech key data elements that specify their intent. [Read More](https://mycroft-ai.gitbook.io/docs/skill-development/user-interaction/intents) *Currently should not contain any special characters and should always be defined in lowercase string*
0105
0106 - **voc** *(required)*: ***Absolute Path to an intent file*** with keywords that can activate the intent. Padatious intents uses a series of example sentences to train a machine learning model to identify an intent. *Currently limited to single Padatious intents. Filenames should start with the application 'namespace_' + define_your_intent_here.intent this is to avoid active intent collision.*
0107
0108 - **action** *(required)*: A string based action response based on the intent triggered, notifies the Skill Manager `"onIntentResponse"` via `"action"` variable letting the application then decide what action to take based on the action received.
0109
0110 - **dialog** *(optional)*: A string of text to be spoken by Mycroft when a positive intent response is received for the registered SkillEntry intent.
0111
0112
0113
0114 ### Controller Class
0115
0116 The controller class is a minified abstraction of the original Mycroft Controller class from the [Mycroft GUI](https://github.com/MycroftAI/mycroft-gui) project, It is a singleton instance that manages web-socket connections and message exchange to the Mycroft message-bus. It additionally also exports signals for various known mycroft type messages that applications can choose to react towards, for example when mycroft is listening or speaking .
0117
0118
0119
0120 ### Audio Transcriber Class and TranscribeButton Component
0121
0122 The AudioTranscriber Object allows applications to implement audio transcribing for TextField, TextEntry type QML Objects. The AudioTranscriber Object is directly implemented in a ready to use TranscribeButton component provided by Libqmycroft.
0123
0124 The TranscribeButton if placed directly in any text field will assume providing the audio transcribed result to the parent.text field, alternatively the TranscribeButton can also be used outside of a TextField component which requires settings its `"target"` property to any TextField component id that wants to implement Audio Transcribe.
0125
0126 Note: The TranscribeButton component is uniquely always only capable of serving a single textfield, each text field in a form for example would require its own transcribe button.
0127
0128
0129
0130 ## Usage Example of Libqmycroft SkillManager & SkillEntry in QML application
0131
0132 ***Example QML Implementation***
0133
0134 ```QML
0135 ...
0136 import Libqmycroft 1.0
0137
0138 Window {
0139 ...
0140 title: qsTr("Hello Mycroft!")
0141
0142 SkillManager {
0143 id: skillRegisteration
0144 skillNamespace: "testskill"
0145
0146 SkillEntry {
0147 intent: "testoneintent"
0148 voc: currentPath + "/vocab/testskill_test_intent_one.intent"
0149 action: "example-action-1"
0150 dialog: "Intent One Successful"
0151 }
0152
0153 SkillEntry {
0154 intent: "testtwointent"
0155 voc: currentPath + "/vocab/testskill_test_intent_two.intent"
0156 action: "example-action-2"
0157 dialog: "Intent Two Successful"
0158 }
0159
0160 onSocketReadyChanged: {
0161 if(socketReady){
0162 skillRegisteration.createSkill()
0163 }
0164 }
0165
0166 onIntentResponse: {
0167 if(action == "example-action-1"){
0168 console.log("Got Example 1 Action")
0169 }
0170 if(action == "example-action-2"){
0171 console.log("Got Example 2 Action")
0172 }
0173 }
0174 }
0175 }
0176 ```
0177
0178 ***Example Voc `"$application-installed-dir/vocab/testskill_test_intent_one.intent"` file implementation***
0179
0180 ```
0181 test application example one dynamic intent
0182 test application example one intent
0183 test first intent of dynamic application
0184 ```
0185
0186 ## Usage Example of Libqmycroft AudioTranscriber in QML application
0187
0188 ***Example QML Implementation***
0189
0190 ```QML
0191 ...
0192 import Libqmycroft 1.0
0193
0194 Window {
0195 ...
0196 title: qsTr("Hello Mycroft!")
0197
0198 TextField {
0199 id: someFormField
0200 placeHolderText: "Enter Address"
0201
0202 TranscribeButton {
0203 width: 100
0204 height: 100
0205 target: someFormField
0206 }
0207 }
0208 }