Code Monkey home page Code Monkey logo

american-british-english-translator's Introduction

American British English Translator

Now online at: http://codewordsolver.com/american-british-english-translator

Reads in a text and identifies words that differ in usage between American English and British English, including:

  1. Words with alternative spellings ("cozy" / "cosy")
  2. Words with different meanings in each of the two dialects ("pants")
  3. Words typically used in only one of the dialects ("ladybug" / "ladybird")

Existing solutions only notice the first category of words, thus failing to prevent the most embarrassing mistakes, such as a British person asking an American colleague for a "rubber".

Installation

$ npm install -g american-british-english-translator

This will install the command english-translate globally, so it will be added automatically to your PATH.

Usage (CLI)

The command line interface can be used in three different ways:

Pipe stdin:

$ echo "That was a right bodge job" | english-translate

Example 2

Analyze a file:

$ english-translate American\ Psycho.txt

Example 1

Prompt:

$ english-translate

Example 3

Command line options

By default english-translate outputs almost everything it can*, but it's possible to refine the output and thus speed up the program by using some command line options:

# Only identify Americanisms
$ english-translate file.txt --american

# Only identify Britishisms
$ english-translate --british

# Only check for spelling differences
$ english-translate --spelling

# Only check for British spellings
$ english-translate --british --spelling

# Don't check spelling differences or different meanings, only check for meanings exclusive to one of the dialects
$ english-translate --exclusive

# Do not use colors
$ english-translate --no-color
  • Common words with tiny subtleties in meaning, such as 'can' or 'through', are ignored by default. These words are configured in data/ignore_list.json. If you want to include them then pass the --showall flag.

Usage (from Node.js)

Include it in your script and call the translate() method:

var translator = require('american-british-english-translator');

var data = "I was gobsmacked";

var options = {
  british: true
};

console.log(JSON.stringify(translator.translate(data, options)));

Sources

Uses modified versions of the following lists:

american-british-english-translator's People

Contributors

hyperreality avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.