All Projects → plurals → Pluralize

plurals / Pluralize

Licence: mit
Pluralize or singularize any word based on a count

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Pluralize

go-pluralize
Pluralize and singularize any word (golang adaptation of https://www.npmjs.com/package/pluralize)
Stars: ✭ 60 (-96.68%)
Mutual labels:  pluralization, english, words, pluralize, plurals, singular
Pluralize.NET
📘 Pluralize or singularize any English word.
Stars: ✭ 50 (-97.23%)
Mutual labels:  english, pluralize, singular
rhymes
Give me an English word and I’ll give you a list of rhymes
Stars: ✭ 34 (-98.12%)
Mutual labels:  english, words
An Array Of English Words
List of ~275,000 English words
Stars: ✭ 114 (-93.69%)
Mutual labels:  english, words
Vocabs
📚 A lightweight online dictionary integration to the command line. No browsers. No paperbacks.
Stars: ✭ 226 (-87.5%)
Mutual labels:  english, words
words-aas
📕 a simple API to generate unique randomized words & phrases.
Stars: ✭ 69 (-96.18%)
Mutual labels:  english, words
ety-python
A Python module to discover the etymology of words
Stars: ✭ 110 (-93.92%)
Mutual labels:  english, words
EnglishText.jl
Utilities for English-language quirks in Julia
Stars: ✭ 12 (-99.34%)
Mutual labels:  pluralization, english
similar-english-words
Give me a word and I’ll give you an array of words that differ by a single letter.
Stars: ✭ 25 (-98.62%)
Mutual labels:  english, words
Profane Words
A very long list of English profanity.
Stars: ✭ 95 (-94.75%)
Mutual labels:  english, words
Machinery Industry Press
本项目预计分享数千册电子书,98%以上为机械工业出版社原版电子书,其余为其它出版社出版的一些经典外文读物的原版译本电子书,每本书都配有当当网一键搜索,可查看书价格和简介。目前共计更新2542册图书
Stars: ✭ 85 (-95.3%)
Mutual labels:  english
Somajo
A tokenizer and sentence splitter for German and English web and social media texts.
Stars: ✭ 85 (-95.3%)
Mutual labels:  english
Wordreview
📚 背单词网页 Django + MySQL + Pug + JS
Stars: ✭ 115 (-93.64%)
Mutual labels:  english
Make Novice
Automation and Make
Stars: ✭ 122 (-93.25%)
Mutual labels:  english
R Raster Vector Geospatial
Introduction to Geospatial Raster and Vector Data with R
Stars: ✭ 76 (-95.8%)
Mutual labels:  english
Random Word
This is a simple python package to generate random english words
Stars: ✭ 75 (-95.85%)
Mutual labels:  words
Memorize
🚀 Japanese-English-Mongolian dictionary. It lets you find words, kanji and more quickly and easily
Stars: ✭ 72 (-96.02%)
Mutual labels:  english
Mnemonic Words
List of words for making random mnemonic sentences
Stars: ✭ 66 (-96.35%)
Mutual labels:  words
Dotnetbook
.NET Platform Architecture book (English, Chinese, Russian)
Stars: ✭ 1,763 (-2.49%)
Mutual labels:  english
Gse
Go efficient multilingual NLP and text segmentation; support english, chinese, japanese and other. Go 高性能多语言 NLP 和分词
Stars: ✭ 1,695 (-6.25%)
Mutual labels:  english

Pluralize

NPM version NPM downloads Build status Test coverage File Size CDNJS

Pluralize and singularize any word.

Installation

npm install pluralize --save
yarn add pluralize
bower install pluralize --save

Node

var pluralize = require('pluralize')

AMD

define(function (require, exports, module) {
  var pluralize = require('pluralize')
})

<script> tag

<script src="pluralize.js"></script>

Why?

This module uses a pre-defined list of rules, applied in order, to singularize or pluralize a given word. There are many cases where this is useful, such as any automation based on user input. For applications where the word(s) are known ahead of time, you can use a simple ternary (or function) which would be a much lighter alternative.

Usage

  • word: string The word to pluralize
  • count: number How many of the word exist
  • inclusive: boolean Whether to prefix with the number (e.g. 3 ducks)

Examples:

pluralize('test') //=> "tests"
pluralize('test', 0) //=> "tests"
pluralize('test', 1) //=> "test"
pluralize('test', 5) //=> "tests"
pluralize('test', 1, true) //=> "1 test"
pluralize('test', 5, true) //=> "5 tests"
pluralize('蘋果', 2, true) //=> "2 蘋果"

// Example of new plural rule:
pluralize.plural('regex') //=> "regexes"
pluralize.addPluralRule(/gex$/i, 'gexii')
pluralize.plural('regex') //=> "regexii"

// Example of new singular rule:
pluralize.singular('singles') //=> "single"
pluralize.addSingularRule(/singles$/i, 'singular')
pluralize.singular('singles') //=> "singular"

// Example of new irregular rule, e.g. "I" -> "we":
pluralize.plural('irregular') //=> "irregulars"
pluralize.addIrregularRule('irregular', 'regular')
pluralize.plural('irregular') //=> "regular"

// Example of uncountable rule (rules without singular/plural in context):
pluralize.plural('paper') //=> "papers"
pluralize.addUncountableRule('paper')
pluralize.plural('paper') //=> "paper"

// Example of asking whether a word looks singular or plural:
pluralize.isPlural('test') //=> false
pluralize.isSingular('test') //=> true

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].