Skip to main content
Skip table of contents

Transcription Menu – Complex Menu Configuration

Menu Configuration

Currently, a single parameter *Track\Settings\SpeechToTextServices (where * can be one of Multi, Easy, Single) contains the complete menu configuration. I suggest to create a separate subkey *Track\Settings\TranscriptionMenu for the new configuration. If both old and new configurations are present, the new config is used.

New parameters in *Track\Settings\TranscriptionMenu

Status: MTE can read this configuration and display the menu according to the config. However, it doesn’t yet call any transcription service.

New entries parameters in the key *Track\Settings\TranscriptionMenu are named Entry_1, Entry_2, Entry_3, etc., with no explicit limit. The sequence is finished when the entry with the next higher number doesn’t exist. These parameters describe the structure of the menu which is displayed in MTE.

Further, one new entry is named Default. It provides data which is common to all Entry_n parameters unless explicitly present. Details on defaulting and overwriting follow.

The values stored at each parameter are JSON objects. Entries which contain an empty object {} are skipped. Otherwise, entries should have the following fields:

Field name

Type

Required?

Description

name

string

required

A string which appears on the menu.

service

string

optional (default applies)

The name of the transcription service; refers to a subkey of Common\SpeechToText.

parameters

object

optional (defaults apply)

Values which are inserted into designated places when the service is called.

level

number (non-negative integer)

required

The menu level.

condition

string or array of strings

optional (defaults to "true")

A boolean condition which defines when the menu item should be inserted. If “condition” is not specified, the item is inserted unconditionally.

Menu Structure

When you right-click a clipboard item or a group of selected clipboard items, a menu pops up. This menu, by default, has one entry “Speech to text” which calls the transcription service if exactly one is configured, or opens a sub menu from which you can pick one of the configured services. The new Entry_n parameters modify the menu structure. You can rename the entry at the top-level menu and add top-level menu items, and you can create additional levels of sub menus.

The "level" field defines the menu level where the respective entry appears. "level": 0 is the main menu. Level-0 entries replace the default entry "Speech to text". If you don't define any level-0 entries, "Speech to text" remains in the menu, and it opens the level-1 sub menu.

At all levels, menus are identical, i.e. they contain the same items , and these items open identical sub menus. However, different parameters govern these menus, so that they can trigger different transcription tasks. Further, you can specify the "condition" field to suppress certain menu items under specific conditions.

If, in any main or sub menu, two items have the same name, only the first item is included.

See below for an example.

Parameters

The “parameters” field contains a JSON object. Each field in this object defines a parameter with a name and a value. The value should be a number, a boolean value or a string. Names are not specified, except they should start with an alphabetic character (lower or upper case). Parameter names and values are case sensitive.

When the transcription service is called, parameter placeholders in the service definition are replaced by the respective values.

Conditions

The "condition" field, if present, defines under which condition the item should appear on the menu. If an item does not appear on the menu, all sub menus below this item are inaccessible.

The value of "condition" can be a string, or an array of strings. A string defines one atomic condition which must be fulfilled if the menu item should appear. If you specify an array of strings, each string defines an atomic condition, and the menu item only appears if all of them are fulfilled (logical AND). To create a logical OR, you can repeat the same menu entry several times, with different conditions.

In an atomic condition, you can use the dollar sign to refer to a parameter that was defined in a previous level, using $parametername or ${parametername}. The respective value is filled in before the condition is evaluated. If the parameter was not defined, an empty string is used.

The atomic condition can contain a comparison, using one of these operators: == (equal), != (not equal), < (less than), <= (less than or equal), > (greater than), >= (greater than or equal). If both operands are numbers, the comparison operates on the numeric values (boolean values are considered as 0 for false and 1 fr true); otherwise, both operands are converted into strings, and a case-sensitive string comparison is executed.

Defaults and Overwrites

All Entry_n parameters must have the "name" and "level" fields. "condition", if not specified, defaults to "true".

The value of the "service" field, and all parameters in the "parameters" field, are inherited from the parent menu unless they are explicitly specified. The ultimate ancestor (the item(s) with "level": 0 or, if not present, with "level": 1, inherit from the Default entry.

That means that and menu item inherits the service definition and all parameter definitions that are not explicitly defined or overwritten.

Example

JSON
Default={"service": "Transcribe", "parameters": {"speaker": false, "quality": "high"}}
Entry_1={"name": "Transcription",                                       "level": 0}
Entry_2={"name": "Transcription with speaker", "parameters": {"speaker": true}, "level: 0"}
Entry_3={"name": "exact", "level": 1}
Entry_4={"name": "fast", "parameters": {"quality": "low"}, "level": 1}}
Entry_5={"name": "deutsch (Schweiz)",   "parameters": {"lang": "de-CH"}, "level": 2}
Entry_6={"name": "deutsch (Deutschl.)", "parameters": {"lang": "de-DE"}, "level": 2}
Entry_7={"name": "français (Suisse)",   "parameters": {"lang": "fr-CH"}, "level": 2}
Entry_8={"name": "italiano (Svizzera)", "parameters": {"lang": "it-CH"}, "level": 2}
Entry_9={"name": "rumantsch",           "parameters": {"lang": "rm"},    "level": 2, "condition": "'$quality'!='low'"}
Entry_10={"name": "english (UK)",       "parameters": {"lang": "en-UK"}, "level": 2, "condition": "$speaker==0"}

The menu generated from this configuration has the following structure (the main menu entry “Speech to text” is replaced by two entries, “Transcription” and “Transcription with speaker”):

CODE
Transcription
+-- exact
|   +-- deutsch (Schweiz)
|   +-- deutsch (Deutschl.)
|   +-- français (Suisse)
|   +-- italiano (Svizzera)
|   +-- rumantsch
|   +-- english (UK)
+-- fast
    +-- deutsch (Schweiz)
    +-- deutsch (Deutschl.)
    +-- français (Suisse)
    +-- italiano (Svizzera)
    +-- english (UK)
Transcription with speaker
+-- exact
|   +-- deutsch (Schweiz)
|   +-- deutsch (Deutschl.)
|   +-- français (Suisse)
|   +-- italiano (Svizzera)
|   +-- rumantsch
|   +-- english (UK)
+-- fast
    +-- deutsch (Schweiz)
    +-- deutsch (Deutschl.)
    +-- français (Suisse)
    +-- italiano (Svizzera)
    +-- english (UK)

Note that the “rumantsch” entry is missing in the “fast” menus, and that “english (UK)” is only available without speaker. This was achieved by defining the respective conditions.

When the user opens the menu, clicks “Transcription with speaker" which opens the “exact/fast” menu, there clicks “fast” which opens the languages menu, and finally clicks “français (Suisse)", a transcription request is issued with the following parameters:

Name

Value

Defined where

lang

“fr-CH”

defined in Entry_8

quality

low

inherited from Entry_4

speaker

false

inherited from Default

Further, the "service" value "Transcribe" is also inherited from Default.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.