PHP Classes

US to UK Text Converter: Convert English text between US and UK spellings

Recommend this page to a friend!
     
  Info   Example   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 118 All time: 9,530 This week: 74Up
Version License PHP version Categories
us-to-uk-converter 1.0.0The PHP License5Localization, PHP 5, Text processing
Description 

Author

This class can convert English text between US and UK spellings.

It can take a text using the UK English spelling and converts to the US spelling and vice-versa. It features:

- 20,000 words covered;
- Multiple sources for words like VarCon/ISpell (18,000 phrases) and WordsWorldWide (8,000 phrases), each lists have been used to cross-check each different, correct errors, and cast off duplicates.
- Variants for British phrases ('unrealisable' and 'unrealiseable');
- Does everyday expression checking with /bWORDb/, so, it will no longer corrupt phrases. "Ax" becomes "Axe", but "Axiomatic" will continue to be as "Axiomatic";
- Checks each phrase in the word list and its ucwords (higher-cased words) formatted model, so no acronyms may be negatively affected ("our group, AX, Avenger Xenophiles," will not be converted to "our group, AXE, Avenger Xenophiles");
- Atomic / Deterministic : American-ize/British-ify will not corrupt meaning ('discus' and 'diskus' have reverse meanings in US/UK, swapping them

Innovation Award
PHP Programming Innovation award nominee
January 2018
Number 5
This class can convert English text between US and UK spellings.

It can take a text using the UK English spelling and converts to the US spelling and vice-versa. It features:

- 20,000 words covered;
- Multiple sources for words like VarCon/ISpell (18,000 phrases) and WordsWorldWide (8,000 phrases), each lists have been used to cross-check each different, correct errors, and cast off duplicates.
- Variants for British phrases ('unrealisable' and 'unrealiseable');
- Does everyday expression checking with /bWORDb/, so, it will no longer corrupt phrases. "Ax" becomes "Axe", but "Axiomatic" will continue to be as "Axiomatic";
- Checks each phrase in the word list and its ucwords (higher-cased words) formatted model, so no acronyms may be negatively affected ("our group, AX, Avenger Xenophiles," will not be converted to "our group, AXE, Avenger Xenophiles");
- Atomic / Deterministic : American-ize/British-ify will not corrupt meaning ('discus' and 'diskus' have reverse meanings in US/UK, swapping them

Manuel Lemos
Picture of javaria razzaq
  Performance   Level  
Name: javaria razzaq <contact>
Classes: 1 package by
Country: Pakistan Pakistan
Age: 29
All time rank: 436755 in Pakistan Pakistan
Week rank: 200 Up5 in Pakistan Pakistan Up
Innovation award
Innovation award
Nominee: 1x

Example

<?php
require('AmericanBritishSpellings.php');
$american_british_spellings = new AmericanBritishSpellings('$var');
$text = "accessorise ageing aggrandisement agonise agonised agonises british to american";
$textx = "accessorize aging aggrandizement agonize agonized agonizes american to british";
$new_text = $american_british_spellings->SwapBritishSpellingsForAmericanSpellings(['text'=>$text]);
print_r($text);
echo
"<br>";
print(
$new_text);
$american = $american_british_spellings->SwapAmericanSpellingsForBritishSpellings(['text'=>$textx]);
echo
"<br>";
print_r($textx);
echo
"<br>";
print_r($american);
?>


  Files folder image Files (3)  
File Role Description
Files folder imageus-to-uk-converter (2 files)
Accessible without login Plain text file README.md Data Auxiliary data

  Files folder image Files (3)  /  us-to-uk-converter  
File Role Description
  Plain text file AmericanBritishSpellings.php Class Class source
  Accessible without login Plain text file index.php Example Example script

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 100%
Total:118
This week:0
All time:9,530
This week:74Up