groovy-pluralize-en:0.2.1

Groovy extension module - helps pluralize words fairly accurately

License

License

Categories

Categories

Groovy Languages
GroupId

GroupId

org.millarts
ArtifactId

ArtifactId

groovy-pluralize-en
Last Version

Last Version

0.2.1
Release Date

Release Date

Type

Type

jar
Description

Description

groovy-pluralize-en:0.2.1
Groovy extension module - helps pluralize words fairly accurately
Project URL

Project URL

https://github.com/david-w-millar/groovy-pluralize-en/
Source Code Management

Source Code Management

https://github.com/david-w-millar/groovy-pluralize-en/

Download groovy-pluralize-en

How to add to project

<!-- https://jarcasting.com/artifacts/org.millarts/groovy-pluralize-en/ -->
<dependency>
    <groupId>org.millarts</groupId>
    <artifactId>groovy-pluralize-en</artifactId>
    <version>0.2.1</version>
</dependency>
// https://jarcasting.com/artifacts/org.millarts/groovy-pluralize-en/
implementation 'org.millarts:groovy-pluralize-en:0.2.1'
// https://jarcasting.com/artifacts/org.millarts/groovy-pluralize-en/
implementation ("org.millarts:groovy-pluralize-en:0.2.1")
'org.millarts:groovy-pluralize-en:jar:0.2.1'
<dependency org="org.millarts" name="groovy-pluralize-en" rev="0.2.1">
  <artifact name="groovy-pluralize-en" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.millarts', module='groovy-pluralize-en', version='0.2.1')
)
libraryDependencies += "org.millarts" % "groovy-pluralize-en" % "0.2.1"
[org.millarts/groovy-pluralize-en "0.2.1"]

Dependencies

compile (2)

Group / Artifact Type Version
org.codehaus.groovy : groovy-all jar 2.3.6
org.atteo : evo-inflector jar 1.2

test (1)

Group / Artifact Type Version
org.spockframework : spock-core jar 0.7-groovy-2.0

Project Modules

There are no modules declared in this project.

Groovy Pluralize Module

Build Status Maven Coordinates

A lightweight Groovy extension module that adds the functionality to get plural inflections for words. Suitable for most English applications.

For more robust needs, checkout IBM’s more comprehensive and feature rich International Components for Unicode library.

Installation

Include the jar is in your classpath, or add it as a dependency to your favorite build tool. Groovy does the rest.

Note
Requires groovy 2.0 or later.
Gradle and Grails
compile 'org.millarts:groovy-pluralize-en:0.2.1'
Groovy Grape
@Grapes(
  @Grab(group='org.millarts', module='groovy-pluralize-en', version='0.2.1')
)
Maven
<dependency>
  <groupId>org.millarts</groupId>
  <artifactId>groovy-pluralize-en</artifactId>
  <version>0.2.1</version>
</dependency>

Usage

Example Usages
// Plural Inflection
assert 'mustache'.plural() == 'mustaches'
assert 'wolf'.plural()     == 'wolves'

// Plural Inflection with Cardinality
assert 'codex'.plural(1) == 'codex'
assert 'codex'.plural(2) == 'codices'
assert 'codex'.plural(8) == 'codices'

// Capitalization
assert 'Life'.plural() == 'Lives'

// Unfortunately, capitalization does not behave consistently for certain words. EG:
assert 'Tooth'.plural() == 'teeth'

Building

This project uses gradle for builds, and includes wrapper scripts so that it is not necessary to explicitly install gradle to build and test the project.

Gradle Examples
$ ./gradlew tasks   (1)
$ ./gradlew jar     (2)
$ ./gradlew test    (3)
$ ./gradlew check   (4)
  1. Lists the available tasks for this project

  2. Builds the jar

  3. Runs tests

  4. Runs tests and checks (eg: code quality checks)

Under the Hood

This module uses the evo-inflector project under the hood, which is based off of Damian Conway’s paper An Algorithmic Approach to English Pluralization. It tends to get things right. See the evo-inflector project for more information.

License

This project is licensed under the terms of the Apache License, Version 2.0.

© 2014 David W Millar

Versions

Version
0.2.1