• Stars
    star
    475
  • Rank 92,465 (Top 2 %)
  • Language
    Go
  • License
    MIT License
  • Created over 9 years ago
  • Updated about 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Pluralizes and singularizes English nouns

Inflection

Inflection pluralizes and singularizes English nouns

wercker status

Basic Usage

inflection.Plural("person") => "people"
inflection.Plural("Person") => "People"
inflection.Plural("PERSON") => "PEOPLE"
inflection.Plural("bus")    => "buses"
inflection.Plural("BUS")    => "BUSES"
inflection.Plural("Bus")    => "Buses"

inflection.Singular("people") => "person"
inflection.Singular("People") => "Person"
inflection.Singular("PEOPLE") => "PERSON"
inflection.Singular("buses")  => "bus"
inflection.Singular("BUSES")  => "BUS"
inflection.Singular("Buses")  => "Bus"

inflection.Plural("FancyPerson") => "FancyPeople"
inflection.Singular("FancyPeople") => "FancyPerson"

Register Rules

Standard rules are from Rails's ActiveSupport (https://github.com/rails/rails/blob/master/activesupport/lib/active_support/inflections.rb)

If you want to register more rules, follow:

inflection.AddUncountable("fish")
inflection.AddIrregular("person", "people")
inflection.AddPlural("(bu)s$", "${1}ses") // "bus" => "buses" / "BUS" => "BUSES" / "Bus" => "Buses"
inflection.AddSingular("(bus)(es)?$", "${1}") // "buses" => "bus" / "Buses" => "Bus" / "BUSES" => "BUS"

Contributing

You can help to make the project better, check out http://gorm.io/contribute.html for things you can do.

Author

jinzhu

License

Released under the MIT License.

More Repositories

1

copier

Copier for golang, copy value from struct to struct and more
Go
5,344
star
2

now

Now is a time toolkit for golang
Go
4,349
star
3

configor

Golang Configuration tool that support YAML, JSON, TOML, Shell Environment
Go
1,697
star
4

vrome

Vrome: Bringing Vim elegance to Chrome
CoffeeScript
618
star
5

zeal-at-point

Search the word at point with Zeal (Emacs)
Emacs Lisp
166
star
6

configure

My dot files for Emacs, Openbox, XMonad, VIM, Golang, Zsh/Bash, tmux, URXVT, ArchLinux, Git, Ruby/Rails, Xbindkey, Vrome...
Emacs Lisp
89
star
7

grb

A tool to simplify working with remote git branches
Go
42
star
8

ipparse

IP Parse,Parse IP
Ruby
20
star
9

capistrano-confirm

Confirm before deploy
Ruby
16
star
10

mail

A Go Email Utility
Go
16
star
11

cacheAjax

jquery plugin to cache ajax request and more.
JavaScript
13
star
12

paygent

Ruby wrapper for paygent
Ruby
9
star
13

backupit

BackupIt: A tool to setup your backup server (backup multi servers once).
Ruby
8
star
14

yac

Yet Another Cheat
Ruby
7
star
15

mycheat

My personal cheat sheet repository for yac
6
star
16

super_list

Ruby
5
star
17

cheat

Public cheat sheet repository for yac
5
star
18

bitpay

Bitpay is a wrapper for chinese payment gateways. (unfinished, but alipay is ready to use...)
Ruby
5
star
19

cookieless

Cookieless is a rack middleware to make your application works with cookie-less devices/browsers without change your application!
Ruby
4
star
20

javascript_localize

javascript localize solution
Ruby
3
star
21

acts_as_tagtree

Tag? Tree? Tags like Tree
Ruby
3
star
22

redgreen

Ruby
2
star
23

jinzhu.github.com

My Github Page
JavaScript
2
star
24

eo

Eo_oE : EasyOperate
Ruby
2
star
25

hz_on_fly

convert hankaku to zenkaku/zenkaku to hankaku on fly
Ruby
2
star
26

acts_as_param

acts as param
Ruby
2
star
27

shanghaionrails

http://jinzhu.github.com/shanghaionrails/
2
star
28

phase_diagram

相图分析
Ruby
2
star
29

testingmachine

Testing Machine is a automated testing tool, make keyword driven testing even easier.
Ruby
1
star
30

jquery-tab-slider

jQuery tab slider
JavaScript
1
star
31

.github

my .github
1
star
32

qLayout

JavaScript
1
star
33

devise

Ruby
1
star
34

omniauth-t163

omniauth for t163 (working)
Ruby
1
star
35

acts_as_node

Ruby
1
star
36

newplugin

newPlugin - New Plugin Generator, make it dead easy to create a new rails plugin.
Ruby
1
star
37

jslib

a collection of javascript utils
JavaScript
1
star
38

enconverter

Encoding Converter, rack middleware used to convert encoding.
Ruby
1
star