Remove BPA from Makefile
[icn.git] / cmd / bpa-operator / vendor / github.com / markbates / inflect / README.md
1 [![Build Status](https://travis-ci.org/markbates/inflect.svg?branch=master)](https://travis-ci.org/markbates/inflect)
2
3 #### INSTALLATION
4
5 go get github.com/markbates/inflect
6
7 #### PACKAGE
8 package inflect
9
10
11 #### FUNCTIONS
12 ```go
13 func AddAcronym(word string)
14 func AddHuman(suffix, replacement string)
15 func AddIrregular(singular, plural string)
16 func AddPlural(suffix, replacement string)
17 func AddSingular(suffix, replacement string)
18 func AddUncountable(word string)
19 func Asciify(word string) string
20 func Camelize(word string) string
21 func CamelizeDownFirst(word string) string
22 func Capitalize(word string) string
23 func Dasherize(word string) string
24 func ForeignKey(word string) string
25 func ForeignKeyCondensed(word string) string
26 func Humanize(word string) string
27 func Ordinalize(word string) string
28 func Parameterize(word string) string
29 func ParameterizeJoin(word, sep string) string
30 func Pluralize(word string) string
31 func Singularize(word string) string
32 func Tableize(word string) string
33 func Titleize(word string) string
34 func Typeify(word string) string
35 func Uncountables() map[string]bool
36 func Underscore(word string) string
37 ```
38
39 #### TYPES
40 ```go
41 type Rule struct {
42     // contains filtered or unexported fields
43 }
44 ```
45
46 used by rulesets
47
48 ```go
49 type Ruleset struct {
50     // contains filtered or unexported fields
51 }
52 ```
53
54 a Ruleset is the config of pluralization rules
55 you can extend the rules with the Add* methods
56
57 ```
58 func NewDefaultRuleset() *Ruleset
59 ```
60 create a new ruleset and load it with the default
61 set of common English pluralization rules
62
63 ```
64 func NewRuleset() *Ruleset
65 ```
66
67 create a blank ruleset. Unless you are going to
68 build your own rules from scratch you probably
69 won't need this and can just use the defaultRuleset
70 via the global inflect.* methods
71
72 ```
73 func (rs *Ruleset) AddAcronym(word string)
74 ```
75 if you use acronym you may need to add them to the ruleset
76 to prevent Underscored words of things like "HTML" coming out
77 as "h_t_m_l"
78
79 ```
80 func (rs *Ruleset) AddHuman(suffix, replacement string)
81 ```
82
83 Human rules are applied by humanize to show more friendly
84 versions of words
85
86 ```
87 func (rs *Ruleset) AddIrregular(singular, plural string)
88 ```
89
90 Add any inconsistent pluralizing/singularizing rules
91 to the set here.
92
93 ```
94 func (rs *Ruleset) AddPlural(suffix, replacement string)
95 ```
96
97 add a pluralization rule
98
99 ```
100 func (rs *Ruleset) AddPluralExact(suffix, replacement string, exact bool)
101 ```
102
103 add a pluralization rule with full string match
104
105 ```
106 func (rs *Ruleset) AddSingular(suffix, replacement string)
107 ```
108
109 add a singular rule
110
111 ```
112 func (rs *Ruleset) AddSingularExact(suffix, replacement string, exact bool)
113 ```
114 same as AddSingular but you can set `exact` to force
115 a full string match
116
117 ```
118 func (rs *Ruleset) AddUncountable(word string)
119 ```
120 add a word to this ruleset that has the same singular and plural form
121 for example: "rice"
122
123 ```
124 func (rs *Ruleset) Asciify(word string) string
125 ```
126 transforms Latin characters like é -> e
127
128 ```
129 func (rs *Ruleset) Camelize(word string) string
130 ```
131 "dino_party" -> "DinoParty"
132
133 ```
134 func (rs *Ruleset) CamelizeDownFirst(word string) string
135 ```
136 same as Camelcase but with first letter downcased
137
138 ```
139 func (rs *Ruleset) Capitalize(word string) string
140 ```
141 uppercase first character
142
143 ```
144 func (rs *Ruleset) Dasherize(word string) string
145 ```
146 "SomeText" -> "some-text"
147
148 ```
149 func (rs *Ruleset) ForeignKey(word string) string
150 ```
151 an underscored foreign key name "Person" -> "person_id"
152
153 ```
154 func (rs *Ruleset) ForeignKeyCondensed(word string) string
155 ```
156 a foreign key (with an underscore) "Person" -> "personid"
157
158 ```
159 func (rs *Ruleset) Humanize(word string) string
160 ```
161 First letter of sentence capitalized
162 Uses custom friendly replacements via AddHuman()
163
164 ```
165 func (rs *Ruleset) Ordinalize(str string) string
166 ```
167 "1031" -> "1031st"
168
169 ```
170 func (rs *Ruleset) Parameterize(word string) string
171 ```
172 param safe dasherized names like "my-param"
173
174 ```
175 func (rs *Ruleset) ParameterizeJoin(word, sep string) string
176 ```
177 param safe dasherized names with custom separator
178
179 ```
180 func (rs *Ruleset) Pluralize(word string) string
181 ```
182 returns the plural form of a singular word
183
184 ```
185 func (rs *Ruleset) Singularize(word string) string
186 ```
187 returns the singular form of a plural word
188
189 ```
190 func (rs *Ruleset) Tableize(word string) string
191 ```
192 Rails style pluralized table names: "SuperPerson" -> "super_people"
193
194 ```
195 func (rs *Ruleset) Titleize(word string) string
196 ```
197 Capitalize every word in sentence "hello there" -> "Hello There"
198
199 ```
200 func (rs *Ruleset) Typeify(word string) string
201 ```
202 "something_like_this" -> "SomethingLikeThis"
203
204 ```
205 func (rs *Ruleset) Uncountables() map[string]bool
206 ```
207
208 ```
209 func (rs *Ruleset) Underscore(word string) string
210 ```
211
212 lowercase underscore version "BigBen" -> "big_ben"
213
214