Extension:Wikispeech

From MediaWiki.org
Jump to navigation Jump to search
This is the documentation for installing and configuring Wikispeech. If you are looking for help on how to use it, see Help:Extension:Wikispeech.
MediaWiki extensions manual
OOjs UI icon advanced.svg
Wikispeech
Release status: beta
Wikispeech logo.svg
Implementation Ajax, API
Description Reads page text out loud using text-to-speech
Author(s) Sebastian Berlin, André Costa and Igor Leturia
Latest version 0.1.2 (2018-10-19)
MediaWiki >= 1.29
Database changes No
License GNU General Public License 2.0 or later
Download
Example
  • $wgWikispeechServerUrl
  • $wgWikispeechRemoveTags
  • $wgWikispeechSegmentBreakingTags
  • $wgWikispeechNamespaces
  • $wgWikispeechKeyboardShortcuts
  • $wgWikispeechSkipBackRewindsThreshold
  • $wgWikispeechHelpPage
  • $wgWikispeechFeedbackPage
  • $wgWikispeechContentSelector
  • $wgWikispeechVoices
Translate the Wikispeech extension if it is available at translatewiki.net
Check usage and version matrix.
Vagrant role wikispeech
Issues Open tasks · Report a bug

The Wikispeech project aims to create an open source text-to-speech tool to make Wikimedia's projects more accessible for people that have difficulties reading for different reasons. Wikispeech will be available as a MediaWiki extension. More information can be found on the project page; this page is just about the Wikispeech extension itself.

The TTS-server[edit]

Diagram over some typical interaction between the components in Wikispeech.

Documentation

The extension uses a service for TTS operations, such as creating audio for utterances. This TTS server consists of a main server, a lexicon server, TTS engines and any additional components that may be required for certain languages.

To prepare an utterance for playing, the extension sends a request to the server. This request contains the utterance as text the and which language it is in. The server processes the text using a lexicon and one of the installed TTS engines, depending on what voice is being used. Once the audio has been generated, a response is returned with a URL to the audio file along with some information that will enable highlighting and skipping. This is then used by the extension to actually play the utterance to the user and the process is repeated for the following utterances as needed.

Main Wikispeech Server[edit]

Repo

The main server has a web API that includes an endpoint for generating speech. It handles internal communication between the underlying servers, listed below.

Pronlex[edit]

Repo

A lexicon server with its own API. Holds information about lexicon entries and has endpoints for lookup and manipulation of them. When processing an utterance, words are looked up in the lexicon and if there is a matching entry it is used for the pronunciation.

TTS engines[edit]

The server supports having multiple TTS engines. Which one is used for a certain utterance depends on which voice is given in the request.

MaryTTS[edit]

Repo

Comes with support for Arabic, English and Swedish.

Additional Components[edit]

Mishkal[edit]

Repo

Used to vocalize Arabic text.

Installation[edit]

  • Download and place the file(s) in a directory called Wikispeech in your extensions/ folder.
  • Run Composer to install PHP dependencies, by issuing composer install in the extension directory. (See T173141 for potential complications.)
  • Add the following code at the bottom of your LocalSettings.php: wfLoadExtension( 'Wikispeech' );
  • Done - Navigate to Special:Version on your wiki to verify that the extension is successfully installed.

Setting up TTS-server[edit]

Wikispeech requires a TTS-server to generate audio. The easiest way to install this is to use the Docker Compose version. The installation instructions can be found at https://github.com/stts-se/wikispeech_compose/tree/master/docker. For other ways to install the server, see http://stts-se.github.io/wikispeech/. Ports 80 and 10000 need to be opened for accessing audio files and sending requests to the server respectively. Detailed instructions for installing the TTS-server on Cloud VPS can be found on /TTS-server on wmflabs.

Basic configuration[edit]

For Wikispeech to be able to communicate with the TTS-server, you need to specify the server's URL. You can do this by adding the following line to LocalSettings.php:

$wgWikispeechServerUrl = 'URL';

where URL is the URL to your TTS-server.

Complete list of configuration options[edit]

Option Default value Documentation
WikispeechServerUrl
""
The URL for the TTS server to use.
WikispeechRemoveTags
{
    "span": "mw-editsection",
    "table": true,
    "sup": "reference",
    "div": [
        "thumb",
        "toc"
    ]
}
Map of HTML tags that should be removed completely, i.e. including any content. Keys are tag names and the values determine whether a tag should be removed, as follows:
  • If true, remove all tags of that type.
  • If an array, remove tags whose class matches any of the strings in the array.
  • If false, tags of that type will not be removed. This can be used in LocalSetting.php to override default criteria.
WikispeechSegmentBreakingTags
[
    "h1",
    "h2",
    "h3",
    "h4",
    "h5",
    "h6",
    "p",
    "br",
    "li"
]
As the text is segmented, segment breaks are added when these tags are encountered. This is useful e.g. for headings, that usually don't trigger segmentation since they're not complete sentences.
WikispeechNamespaces
[
    0
]
List of the namespace indices, for which Wikispeech is activated.
WikispeechKeyboardShortcuts
{
    "playStop": {
        "key": 32,
        "modifiers": [
            "alt",
            "shift"
        ]
    },
    "skipAheadSentence": {
        "key": 39,
        "modifiers": [
            "alt",
            "shift"
        ]
    },
    "skipBackSentence": {
        "key": 37,
        "modifiers": [
            "alt",
            "shift"
        ]
    },
    "skipAheadWord": {
        "key": 40,
        "modifiers": [
            "alt",
            "shift"
        ]
    },
    "skipBackWord": {
        "key": 38,
        "modifiers": [
            "alt",
            "shift"
        ]
    }
}
Shortcuts for Wikispeech commands. Each shortcut defines the key pressed (as key code[1]) and any modifier keys (ctrl, alt or shift).
WikispeechSkipBackRewindsThreshold
3.0
If an utterance has played longer than this (in seconds), skipping back will rewind to the start of the current utterance, instead of skipping to previous utterance.
WikispeechHelpPage
"Help:Wikispeech"
Help page for Wikispeech. If defined, a button that takes the user here is added next to the player buttons.
WikispeechFeedbackPage
"Wikispeech feedback"
Feedback page for Wikispeech. If defined, a button that takes the user here is added next to the player buttons.
WikispeechContentSelector
"#mw-content-text"
The selector for the element that contains the text of the page. Used internally, but may change with MediaWiki version.
WikispeechVoices
{
    "ar": [
        "ar-nah-hsmm"
    ],
    "en": [
        "dfki-spike-hsmm",
        "cmu-slt-flite"
    ],
    "sv": [
        "stts_sv_nst-hsmm"
    ]
}
The voices that will show up in the user settings. Available voices can be found at the /synthesis/voices on the TTS-server.

CSS[edit]

This is a subset the CSS rules that are most interesting for a non-developer.

Selector Default values Documentation
.ext-wikispeech-highlight-sentence
background-color: rgb( 200, 170, 255 );
The visual highlighting for the sentence that is currently being recited.
.ext-wikispeech-highlight-word
background-color: rgb( 255, 200, 140 );
The visual highlighting for the word that is currently being recited.

References[edit]