MCPcopy Index your code
hub / github.com/atteo/evo-inflector

github.com/atteo/evo-inflector @1.3

Chat with this repo
repository ↗ · DeepWiki ↗ · release 1.3 ↗ · + Follow
63 symbols 117 edges 12 files 3 documented · 5% 1 cross-repo links
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Build Status Coverage Status Maven Central

About

Evo Inflector implements English pluralization algorithm based on "Damian Conway's" paper "An Algorithmic Approach to English Pluralization".

Usage

The usage is pretty simple:

English.plural("word") == "words"

Additionaly you can use provide a required count to select singular or plural form automatically:

English.plural("foot", 1)) == "foot"
English.plural("foot", 2)) == "feet"

Features

The algorithm tries to preserve the capitalization of the original word, for instance:

English.plural("NightWolf") == "NightWolves"

Limitations:

  • The algorithm cannot reliably detect uncountable words. It will pluralize them anyway.
  • There are words which have the same singular form and multiple plural forms, ex: die (plural dies) - The cubical part of a pedestal; a plinth. die (plural dice) - An isohedral polyhedron, usually a cube

Tests

As part of the unit tests the results of the algorithm are compared with data from Wiktionary.

There are (2021-07-10) 276574 single word english nouns in the English Wiktionary of which: - 69.26971% (191582) are countable nouns, - 27.56839% (76247) are uncountable nouns, - for 2.8863885% (7983) nouns plural is unknown, - for 0.27551398% (762) nouns plural is not attested.

Evo Inflector returns correct answer for: - 96.24286% (184384) of all countable nouns, see this report, - but only for 8.56296% (6529) of uncountable nouns.

In overall it returns correct answer for 69.02782% (190913) of all nouns.

Changes

1.3 - fix ulum -> ula rule - return empty string for empty string input - improve preservation of letter capitalization - make tests up-to-date with change in Wiktionary

1.2.2 - fix pluralization of todo

1.2 - compile with Java 1.6 for better compatibility - -s -> -ses, for instance pancreas -> pancrases - -ulum -> -ula, for instance baculum -> bacula - some minor optimizations - better testing with Wiktionary dump

1.1 - fix for -us ending words, like virus

1.0.1 - add inflection with count

1.0 Initial revision

License

Evo Inflector is available under Apache License 2.0.

Download

You can download the library from here or use the following Maven dependency:

<dependency>
    <groupId>org.atteo</groupId>
    <artifactId>evo-inflector</artifactId>
    <version>1.3</version>
</dependency>

or the Gradle dependency:

compile group: 'org.atteo', name: 'evo-inflector', version: '1.2.2'

Extension points exported contracts — how you extend this code

Core symbols most depended-on inside this repo

categoryRule
called by 23
src/main/java/org/atteo/evo/inflector/TwoFormInflector.java
getPlural
called by 13
src/main/java/org/atteo/evo/inflector/Rule.java
rule
called by 13
src/main/java/org/atteo/evo/inflector/TwoFormInflector.java
irregular
called by 3
src/main/java/org/atteo/evo/inflector/TwoFormInflector.java
plural
called by 2
src/main/java/org/atteo/evo/inflector/English.java
uncountable
called by 1
src/main/java/org/atteo/evo/inflector/TwoFormInflector.java
English
called by 0
src/main/java/org/atteo/evo/inflector/English.java
getPlural
called by 0
src/main/java/org/atteo/evo/inflector/English.java

Shape

Method 49
Class 11
Enum 2
Interface 1

Languages

Java100%

Modules by API surface

src/test/java/org/atteo/evo/inflector/WikiNoun.java19 symbols
src/test/java/org/atteo/evo/inflector/EnglishInflectorTest.java9 symbols
src/main/java/org/atteo/evo/inflector/TwoFormInflector.java6 symbols
src/main/java/org/atteo/evo/inflector/English.java6 symbols
src/test/java/org/atteo/evo/inflector/Revision.java5 symbols
src/test/java/org/atteo/evo/inflector/Page.java5 symbols
src/main/java/org/atteo/evo/inflector/RegExpRule.java3 symbols
src/main/java/org/atteo/evo/inflector/CategoryRule.java3 symbols
src/test/java/org/atteo/evo/inflector/WikiParser.java2 symbols
src/test/java/org/atteo/evo/inflector/WikiNounTest.java2 symbols
src/main/java/org/atteo/evo/inflector/Rule.java2 symbols
src/test/java/org/atteo/evo/inflector/NounType.java1 symbols

Used by 1 indexed graphs manifest dependencies, hub-wide

For agents

$ claude mcp add evo-inflector \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact