Jump to content

Extension:WandaScore

From mediawiki.org
MediaWiki extensions manual
WandaScore
Release status: stable
[[File:
Screenshot of the Wanda AI Assistant chat interface for Extension:Wanda documentation
|px]]
Implementation Special page , Artificial intelligence, API , Page action , Data extraction
Description WandaScore is a MediaWiki extension that provides AI-powered content quality scoring and review for wiki pages. It leverages the Wanda extension to analyze pages based on multiple quality factors and displays an easy-to-understand score.
Author(s) Sanjay Thiyagarajan (Techwizzietalk)
Latest version 1.0.0
MediaWiki 1.42+
Database changes Yes
  • $wgWandaScoreThresholds
  • $wgWandaScoreAutoReview
  • $wgWandaScoreShowTile
  • $wgWandaScoreNamespaces
Licence GNU General Public License 2.0 or later
Download
Translate the WandaScore extension if it is available at translatewiki.net
Issues Open tasks · Report a bug

WandaScore is a MediaWiki extension that provides AI-powered content quality scoring and review for wiki pages. It leverages the Wanda extension to analyze pages based on multiple quality factors and displays an easy-to-understand score.

Installation

[edit]
  • Download and move the extracted WandaScore folder to your extensions/ directory.
    Developers and code contributors should install the extension from Git instead, using:
    cd extensions/
    git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/WandaScore
    
  • Add the following code at the bottom of your LocalSettings.php file:
    wfLoadExtension( 'WandaScore' );
    
  • Run the update script which will automatically create the necessary database tables that this extension needs.
  • Ensure that Wanda extension is installed and configured
  • Yes Done – Navigate to Special:Version on your wiki to verify that the extension is successfully installed.

Features

[edit]
  • Comprehensive Content Analysis: Reviews pages based on 5 key quality factors:
    • Bias Detection: Identifies potential bias and neutrality issues
    • Human-Written Content Detection: Detects AI-generated content
    • Language Quality: Evaluates clarity, readability, and professionalism
    • Grammar & Spelling: Identifies grammatical errors and spelling mistakes
    • Conciseness: Assesses verbosity and content structure
  • Visual Score Tile: Floating score tile on pages showing overall quality score (0-100)
  • Detailed Review Page: Comprehensive breakdown of all scoring factors with AI-generated explanations
  • Automatic Scoring: Automatically scores pages when created or modified via job queue
  • Modern UI: Built with Vue 3 and MediaWiki Codex design system
  • Configurable: Control which namespaces to review and customize scoring behavior
  • Cached Results: Stores scores in database for fast retrieval
  • API Access: RESTful API for programmatic access to scores

Configuration

[edit]

Add these configuration variables to your LocalSettings.php after loading the extension:

Basic Configuration

[edit]
// Namespaces where WandaScore should review pages (default: [0] = main namespace)
$wgWandaScoreNamespaces = [ 0 ];  // Add more namespaces as needed: [ 0, 2, 4, 100 ]

// Enable/disable automatic review on page save (default: true)
$wgWandaScoreAutoReview = true;

// Show/hide the score tile on pages (default: true)
$wgWandaScoreShowTile = true;

// Customize score thresholds for quality levels
$wgWandaScoreThresholds = [
    'excellent' => 90,  // Scores >= 90 are excellent
    'good' => 70,       // Scores >= 70 are good
    'fair' => 50,       // Scores >= 50 are fair
    'poor' => 0         // Scores < 50 are poor
];

Configuration Examples

[edit]

Review only main namespace and help pages:

$wgWandaScoreNamespaces = [ 0, 12 ];  // 0 = Main, 12 = Help

Disable automatic scoring (manual review only):

$wgWandaScoreAutoReview = false;

Hide score tile but keep detailed reviews available:

$wgWandaScoreShowTile = false;

Configuration Parameters

[edit]

All configuration parameters with their default values:

Parameter Default Description
$wgWandaScoreNamespaces [0] Array of namespace IDs where WandaScore reviews pages
$wgWandaScoreAutoReview true Whether to automatically review pages on save
$wgWandaScoreShowTile true Whether to show the score tile on pages
$wgWandaScoreThresholds See above Score thresholds for quality level classification

Usage

[edit]

Score Tile

[edit]

When enabled, a floating score tile appears in the top-right corner of pages in configured namespaces. The tile displays:

  • 📊 A visual indicator
  • The overall score (0-100)
  • Color-coded by quality:
    • 🟢 Green (90-100): Excellent quality
    • 🔵 Blue (70-89): Good quality
    • 🟡 Yellow (50-69): Fair quality, needs improvement
    • 🔴 Red (0-49): Poor quality, requires significant improvement

Click the tile to view the detailed review page.

Detailed Review Page

[edit]

Access detailed reviews in two ways:

  1. Click the score tile on any page
  2. Navigate to Special:WandaScore and enter a page title

The review page displays:

  • Overall score with quality indicator and color coding
  • Breakdown of all 5 scoring factors with individual scores
  • Detailed AI-generated explanations for each factor
  • Timestamp of the last review
  • "Refresh Score" button to regenerate the score with latest content

Automatic Scoring

[edit]

When $wgWandaScoreAutoReview is enabled:

  • Pages are automatically scored when created
  • Pages are re-scored when edited
  • Scoring happens asynchronously via MediaWiki's job queue (doesn't slow down saves)
  • Run jobs with: php maintenance/runJobs.php

Manual Scoring via Special Page

[edit]
  1. Navigate to Special:WandaScore
  2. Enter the page title you want to review
  3. Click "View Review"
  4. Click "Refresh Score" to regenerate with latest content

API

[edit]

The extension provides an API module accessible via api.php?action=wandascore.

Parameters

[edit]
Parameter Required Description
action Yes Must be set to wandascore
page Yes Title of the page to score
refresh No Force refresh the score instead of using cached value (default: false)
format No Response format, recommended: json

Example Request

[edit]
# Get cached score
api.php?action=wandascore&page=Main_Page&format=json

# Force refresh score
api.php?action=wandascore&page=Main_Page&refresh=true&format=json

Example Response

[edit]
{
  "wandascore": {
    "overall_score": 85,
    "factors": {
      "bias": {
        "score": 90,
        "details": "The content appears neutral and unbiased with balanced perspectives..."
      },
      "llm_generated": {
        "score": 88,
        "details": "The writing style suggests human authorship with personal examples..."
      },
      "language_quality": {
        "score": 82,
        "details": "Clear and professional language with good readability..."
      },
      "grammar": {
        "score": 85,
        "details": "Generally correct grammar with minor punctuation issues..."
      },
      "conciseness": {
        "score": 80,
        "details": "Well-structured content with minimal redundancy..."
      }
    },
    "timestamp": "20251026153045",
    "page_id": 1,
    "page_title": "Main_Page"
  }
}

How It Works

[edit]

The extension follows this workflow:

  1. Content Extraction: When a page is saved (or manually scored), WandaScore extracts the page content
  2. AI Analysis: For each of the 5 quality factors, it sends a specialized prompt to Wanda's configured LLM
  3. Score Calculation: Each factor receives a score (0-100) with detailed AI-generated feedback
  4. Weighted Average: An overall score is calculated using weighted averages:
    • LLM Detection: 1.5× weight (most important for detecting AI-generated content)
    • Bias Detection: 1.2× weight
    • Grammar & Spelling: 1.1× weight
    • Language Quality: 1.0× weight
    • Conciseness: 0.8× weight
  5. Caching: Results are stored in the wandascore database table for fast retrieval
  6. Display: Scores are shown via the floating tile and detailed review page

Scoring Factors Explained

[edit]

1. Bias Detection (⚖️)

[edit]

Analyzes content for adherence to neutral point of view. Identifies:

  • Political or ideological bias
  • Promotional language or advertising tone
  • Loaded terms or weasel words
  • Unbalanced perspectives

2. Human-Written Content Detection (🤖)

[edit]

Detects AI-generated text by looking for characteristic patterns:

  • Repetitive sentence structures
  • Generic phrasing and clichés
  • Lack of personal voice, examples, or anecdotes
  • Overly formal or stilted writing style

3. Language Quality (🌐)

[edit]

Evaluates overall language quality:

  • Clarity and readability
  • Professional and appropriate tone
  • Appropriate vocabulary for the subject
  • Logical flow and coherence

4. Grammar & Spelling (✍️)

[edit]

Checks for mechanical correctness:

  • Grammatical errors
  • Spelling mistakes
  • Punctuation issues
  • Syntax problems

5. Conciseness (📝)

[edit]

Assesses whether content is appropriately concise:

  • Freedom from unnecessary verbosity
  • Well-structured and organized
  • Direct and to the point
  • Appropriate detail level for the subject

For Content Reviewers

[edit]

WandaScore is designed to assist manual content reviewers and editors:

  1. Quick Assessment: The score tile provides an at-a-glance quality indicator without reading the entire page
  2. Detailed Insights: The review page explains specific issues that need addressing
  3. Prioritization: Focus review efforts on pages with lower scores first
  4. Educational Tool: Helps editors understand what constitutes quality content
  5. Consistency: Provides objective, consistent quality metrics across all pages

Hooks

[edit]

The extension uses several MediaWiki hooks:

BeforePageDisplay

[edit]

Adds the score tile resource loader module to pages in configured namespaces.

PageSaveComplete

[edit]

Triggers automatic scoring job when pages are saved (if $wgWandaScoreAutoReview is enabled).

LoadExtensionSchemaUpdates

[edit]

Handles database schema updates for the wandascore table.

Troubleshooting

[edit]

Common Issues

[edit]

Score tile not appearing

  • Check that $wgWandaScoreShowTile is true
  • Verify the current namespace is in $wgWandaScoreNamespaces
  • Clear browser cache: Ctrl+Shift+R or Cmd+Shift+R
  • Purge MediaWiki resource loader cache: action=purge

"Error generating score" message

  • Ensure Wanda extension is installed and properly configured
  • Check that Wanda's LLM provider is working correctly
  • Verify Elasticsearch is running (required by Wanda for content retrieval)
  • Check MediaWiki error logs: debug.log or error.log
  • Test Wanda directly at Special:Wanda to verify it's functioning

Scores not updating automatically

  • Verify $wgWandaScoreAutoReview is true
  • Check that the job queue is running: php maintenance/runJobs.php
  • For immediate scoring, use the "Refresh Score" button on the review page
  • Check job queue status: php maintenance/showJobs.php

Slow performance

  • Scoring is computationally intensive; consider:
    • Using a faster LLM model (e.g., smaller Ollama models)
    • Disabling automatic review for frequently edited pages/namespaces
    • Running job queue in the background continuously
    • Increasing $wgJobRunRate if jobs are blocking page saves

Database errors after installation

  • Ensure you ran php maintenance/update.php after installing
  • Check database permissions for creating tables
  • Manually run: php maintenance/run.php sql/wandascore.sql

Security Considerations

[edit]
  • All LLM interactions are performed through the Wanda extension's security layer
  • Page content is sanitized before display using MediaWiki's output escaping
  • Scores are cached in the database to prevent API abuse
  • Job queue prevents DoS attacks from repeated page saves
  • Special page and API respect MediaWiki user permissions
  • No sensitive data is sent to LLM providers beyond page content
  • For sensitive wikis, use self-hosted Ollama instead of external LLM services

Performance Considerations

[edit]
  • Scoring is computationally intensive and requires multiple LLM calls (one per factor)
  • Average scoring time: 10-30 seconds depending on LLM provider and model
  • Asynchronous job queue ensures page saves are not blocked
  • Results are cached indefinitely until page is edited or score is manually refreshed
  • Database indexes optimize score retrieval
  • Consider disabling auto-review for high-traffic pages or frequent edits