Physikerwelt has uploaded a new change for review. https://gerrit.wikimedia.org/r/254845
Change subject: Add UI to evaluate MLP results ...................................................................... Add UI to evaluate MLP results * Step 1 select a page to evaluate Change-Id: I81f6b3f756e03ecd85d0505f32748d787d11238b --- M MathSearch.alias.php M extension.json M i18n/en.json M i18n/qqq.json A includes/special/SpecialMlpEval.php A modules/ext.MathSearch.autocomplete.js 6 files changed, 128 insertions(+), 2 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MathSearch refs/changes/45/254845/1 diff --git a/MathSearch.alias.php b/MathSearch.alias.php index 81b4c58..2d11542 100644 --- a/MathSearch.alias.php +++ b/MathSearch.alias.php @@ -12,6 +12,7 @@ /** English (English) */ $specialPageAliases['en'] = array( 'MathSearch' => array( 'MathSearch', 'Math Search' ), + 'MlpEval' => array( 'MlpEval', 'Mathematical Language Processing Evaluation' ), 'MathDebug' => array( 'MathDebug', 'Math Debug' ), 'FormulaInfo' => array( 'FormulaInfo', 'Formula Info' ), 'GetEquationsByQuery' => array( 'GetEquationsByQuery', 'Get Formulae by Query' ), diff --git a/extension.json b/extension.json index c304f5a..3975535 100644 --- a/extension.json +++ b/extension.json @@ -9,6 +9,7 @@ "AutoloadClasses": { "MathSearchHooks": "MathSearch.hooks.php", "SpecialMathSearch": "includes/special/SpecialMathSearch.php", + "SpecialMlpEval": "includes/special/SpecialMlpEval.php", "FormulaInfo": "FormulaInfo.php", "MathObject": "MathObject.php", "MathQueryObject": "MathQueryObject.php", @@ -84,14 +85,24 @@ "desktop", "mobile" ] + }, + "ext.MathSearch.special": { + "scripts": [ + "ext.MathSearch.autocomplete.js" + ], + "dependencies": [ + "jquery.ui.autocomplete" + ] } + }, "ResourceFileModulePaths": { - "localBasePath": "", - "remoteExtPath": "MathSearch" + "localBasePath": "modules", + "remoteExtPath": "MathSearch/modules" }, "SpecialPages": { "MathSearch": "SpecialMathSearch", + "MlpEval": "SpecialMlpEval", "FormulaInfo": "FormulaInfo", "GetEquationsByQuery": "GetEquationsByQuery", "MathDebug": "SpecialMathDebug", diff --git a/i18n/en.json b/i18n/en.json index 27fe3c1..478f9b3 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -5,6 +5,7 @@ ] }, "mathsearch": "Math search", + "mlpeval": "Mathematical Language Processing evaluation", "formulainfo": "Formula info", "mathdownload": "Download math search results", "mathindex": "Math index", diff --git a/i18n/qqq.json b/i18n/qqq.json index 8b33c9c..7955cd3 100644 --- a/i18n/qqq.json +++ b/i18n/qqq.json @@ -10,6 +10,7 @@ ] }, "mathsearch": "{{doc-special|MathSearch}}\n\"Math Search\" is the name of the MediaWiki extension which integrates the [http://search.mathweb.org/ MathWeb Search] engine.\n\nMath Search is used to search for a formula based on their MathML representation.\n{{Identical|Math search}}", + "mlpeval": "{{doc-special|MlpEval}}\nThe special page \"Mathematical Language Processing evaluation\" provides an interface to evaluate the results of the MLP tool.", "formulainfo": "{{doc-special|FormulaInfo}}\nThe special page displays technical information about the formula, e.g. the variables it contains and information about rendering etc.", "mathdownload": "{{doc-special|MathDownload}}\nUsers and admins can download submissions to the wmc math search search challenge for archival.", "mathindex": "{{doc-special|MathIndex}}\nThe special page provides a user interface to the maintenance scripts to maintain the index for mathematical formulae.", diff --git a/includes/special/SpecialMlpEval.php b/includes/special/SpecialMlpEval.php new file mode 100644 index 0000000..bea58c6 --- /dev/null +++ b/includes/special/SpecialMlpEval.php @@ -0,0 +1,86 @@ +<?php + +use MediaWiki\Logger\LoggerFactory; + +/** + * MediaWiki MathSearch extension + * + * (c) 2015 Moritz Schubotz + * GPLv2 license; info in main package. + * + * @file + * @ingroup extensions + */ +class SpecialMlpEval extends SpecialPage { + function __construct() { + parent::__construct( 'MlpEval' ); + } + + /** + * The main function + */ + public function execute( $par ) { + $request = $this->getRequest(); + $this->setHeaders(); + $this->selectPageForm()->show(); + } + + /** + * Generates the search input form + */ + private function selectPageForm() { + $this->getOutput()->addModules( 'ext.MathSearch.special' ); + $formDescriptor = array( + 'evalPage' => array( + 'label' => 'Page to evaluate', # What's the label of the field + 'class' => 'HTMLTextField' # What's the input type + ) + ); + $htmlForm = new HTMLForm( $formDescriptor, $this->getContext() ); + $htmlForm->setSubmitText( 'Select' ); + $htmlForm->setSubmitCallback( array( $this, 'processInput' ) ); + $htmlForm->setHeaderText( "<h2>Step 1: Select a page</h2>" ); + return $htmlForm; + } + + + + /** + * Processes the submitted Form input + * @param array $formData + * @return bool + */ + public function processInput( $formData ) { + + $this->performSearch(); + } + + public function performSearch() { + $out = $this->getOutput(); + $out->addWikiText( '==Results==' ); + $out->addWikiText( 'You searched for the following terms:' ); + + } + + /** + * + * @param String $src + * @param String $lang the language of the source snippet + */ + private function printSource( $src, $lang = "xml" ) { + $out = $this->getOutput(); + $out->addWikiText( '<source lang="' . $lang . '">' . $src . '</source>' ); + } + + private function enableMathStyles() { + $out = $this->getOutput(); + $out->addModuleStyles( + array( 'ext.math.styles' , 'ext.math.desktop.styles', 'ext.math.scripts' ) + ); + } + + + protected function getGroupName() { + return 'mathsearch'; + } +} diff --git a/modules/ext.MathSearch.autocomplete.js b/modules/ext.MathSearch.autocomplete.js new file mode 100644 index 0000000..9edea8f --- /dev/null +++ b/modules/ext.MathSearch.autocomplete.js @@ -0,0 +1,26 @@ +/** + * Add autocomplete suggestions to any input. + * @author Legoktm + * Mainly from http://jqueryui.com/autocomplete/ + * and resources/mediawiki/mediawiki.searchSuggest.js + */ + +( function ( mw, $ ) { + $( function () { + // mw-massmessage-form-spamlist is the id of the field to autocomplete + $( '#mw-input-wpevalPage' ).autocomplete( { + source: function( request, response ) { + // Create a new Api object (see [[RL/DM#mediawiki.api]] + var api = new mw.Api(); + // Start a "GET" request + api.get( { + action: 'opensearch', + search: request.term, // This is the current value of the user's input + suggest: '' + } ).done( function ( data ) { + response( data[1] ); // set the results as the autocomplete options + } ); + } + } ); + } ); +}( mediaWiki, jQuery ) ); \ No newline at end of file -- To view, visit https://gerrit.wikimedia.org/r/254845 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I81f6b3f756e03ecd85d0505f32748d787d11238b Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/MathSearch Gerrit-Branch: master Gerrit-Owner: Physikerwelt <w...@physikerwelt.de> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits