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
Crystal Clear action run.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)
Database changes No
License GNU General Public License 2.0 or later
Download
Example
Parameters
  • $wgWikispeechServerUrl
  • $wgWikispeechRemoveTags
  • $wgWikispeechSegmentBreakingTags
  • $wgWikispeechNamespaces
  • $wgWikispeechKeyboardShortcuts
  • $wgWikispeechSkipBackRewindsThreshold
  • $wgWikispeechHelpPage
  • $wgWikispeechFeedbackPage
  • $wgWikispeechContentSelector
  • $wgWikispeechVoices
Hooks used
ResourceLoaderTestModules
ParserAfterTidy
BeforePageDisplay
ResourceLoaderGetConfigVars
GetPreferences
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.

User guide[edit]

For an end user guide to Wikispeech, see Help:Extension:Wikispeech.

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]