Wire Word Tools (EN)

API methods for English word inflection and lemmatization plus ability to use them in search queries.

ProcessWire Word Tools module

Currently focused on English language word functions including inflection and lemmatisation. Provides a simple API for using these functions.

Provides the ability to automatically hook into ProcessWire (3.0.162+) to enhance text searches that use any operator with a plus in "+" in it, which are the query expansion operators. For example, a search query for “fishing boat” …

$pages->find('title~|+=fishing boat');

…would automatically expand to include all these words: fishing, fished, fishes, fish, boat, boats, boating.

Please note the results are not always going to be perfect here, but intended to strike a balance between maintainability and accuracy. The goal being to provide potentially helpful word additions for ProcessWire-based search engines needing word variations.

The JSON dictionary files in the ./lemmas/ and ./roots/ directories was converted from PHP files in the Lemmatizer project © 2018 Mark Fullmer.

Install


  1. Copy all module files to: /site/modules/WireWordTools/
  2. In the ProcessWire admin, click to Modules > Refresh
  3. On the Modules > Site tab, click “Install” for this module.

API Methods


// Get instance of module
$tools = $modules->get('WireWordTools');

// Get alternate words for given word
// returns [ 'words', 'worded', 'wording' ]
$words = $tools->getWords('word');

// Get plural value of given word
// returns "words"
$plural = $tools->getPlural('word');

// Get singular value of given word
// returns "word"
$singular = $tools->getSingular('words');

This module is a work in progress and more methods are likely to be added, word data expanded, etc.

More modules by Ryan Cramer

  • Hanna Code

    Easily insert any complex HTML, Javascript or PHP output in your ProcessWire content by creating your own Hanna code tags.
  • Form Builder PRO

    Building front-end forms on your website has never been so simple. ProcessWire Form Builder lets you create, edit and publish forms with no development necessary.
  • ProCache PRO

    ProCache provides the ultimate performance for your website by completely bypassing PHP and MySQL and enabling your web server to deliver pages of your ProcessWire site as if they were static HTML…
  • ProcessWire Upgrade

    Tool that helps you identify and install core and module upgrades.
  • Map Marker (Google Maps)

    This Fieldtype for ProcessWire 2.1+ holds an address or location name, and automatically geocodes the address to latitude/longitude using Google Maps API.
  • Site Profile Exporter

    Enables exporting of ProcessWire site profiles for sharing or distribution with others.
  • Video embed for YouTube/Vimeo

    Enables translation of YouTube or Vimeo URLs to full embed codes, resulting in a viewable video in textarea fields you apply it to. Now with support for responsive videos too.
  • Import Pages from CSV files

    Enables you to import CSV files to create pages.
  • Database Backups

    Create and/or restore database backups from the ProcessWire admin.

All modules by Ryan Cramer

Install and use modules at your own risk. Always have a site and database backup before installing new modules.