Permalink
Browse files

Merge pull request #14 from knu/update_inflectors

Update inflectors based on the latest and frozen rule set defined in Rails
  • Loading branch information...
purcell committed Sep 13, 2017
2 parents 40a7ffd + 43184f5 commit e4f1372cf22e811faca52fc86bdd5d817498a4d8
Showing with 26 additions and 20 deletions.
  1. +26 −20 inflections.el
View
@@ -66,29 +66,35 @@
,@body))))))))
(define-inflectors
+ ;; Rules copied from https://github.com/rails/rails/blob/master/activesupport/lib/active_support/inflections.rb
(:plural "$" "s")
(:plural "s$" "s")
(:plural "\\(ax\\|test\\)is$" "\\1es")
(:plural "\\(octop\\|vir\\)us$" "\\1i")
+ (:plural "\\(octop\\|vir\\)i$" "\\1i")
(:plural "\\(alias\\|status\\)$" "\\1es")
(:plural "\\(bu\\)s$" "\\1ses")
(:plural "\\(buffal\\|tomat\\)o$" "\\1oes")
(:plural "\\([ti]\\)um$" "\\1a")
+ (:plural "\\([ti]\\)a$" "\\1a")
(:plural "sis$" "ses")
(:plural "\\(?:\\([^f]\\)fe\\|\\([lr]\\)f\\)$" "\\1\\2ves")
(:plural "\\(hive\\)$" "\\1s")
(:plural "\\([^aeiouy]\\|qu\\)y$" "\\1ies")
(:plural "\\(x\\|ch\\|ss\\|sh\\)$" "\\1es")
- (:plural "\\(matr\\|vert\\|ind\\)ix\\|ex$" "\\1ices")
- (:plural "\\([m\\|l]\\)ouse$" "\\1ice")
+ (:plural "\\(matr\\|vert\\|ind\\)\\(ix\\|ex\\)$" "\\1ices")
+ (:plural "\\(m\\|l\\)ouse$" "\\1ice")
+ (:plural "\\(m\\|l\\)ice$" "\\1ice")
(:plural "^\\(ox\\)$" "\\1en")
+ (:plural "^\\(oxen\\)$" "\\1")
(:plural "\\(quiz\\)$" "\\1zes")
(:singular "s$" "")
+ (:singular "\\(ss\\)$" "\\1")
(:singular "\\(n\\)ews$" "\\1ews")
(:singular "\\([ti]\\)a$" "\\1um")
- (:singular "\\(\\(a\\)naly\\|\\(b\\)a\\|\\(d\\)iagno\\|\\(p\\)arenthe\\|\\(p\\)rogno\\|\\(s\\)ynop\\|\\(t\\)he\\)ses$" "\\1\\2sis")
- (:singular "\\(^analy\\)ses$" "\\1sis")
+ (:singular "\\(\\(a\\)naly\\|\\(b\\)a\\|\\(d\\)iagno\\|\\(p\\)arenthe\\|\\(p\\)rogno\\|\\(s\\)ynop\\|\\(t\\)he\\)\\(ses\\|sis\\)$" "\\1sis")
+ (:singular "\\(^analy\\)\\(ses\\|sis\\)$" "\\1sis")
(:singular "\\([^f]\\)ves$" "\\1fe")
(:singular "\\(hive\\)s$" "\\1")
(:singular "\\(tive\\)s$" "\\1")
@@ -97,38 +103,38 @@
(:singular "\\(s\\)eries$" "\\1eries")
(:singular "\\(m\\)ovies$" "\\1ovie")
(:singular "\\(x\\|ch\\|ss\\|sh\\)es$" "\\1")
- (:singular "\\([m\\|l]\\)ice$" "\\1ouse")
- (:singular "\\(bus\\)es$" "\\1")
+ (:singular "\\(m\\|l\\)ice$" "\\1ouse")
+ (:singular "\\(bus\\)\\(es\\)?$" "\\1")
(:singular "\\(o\\)es$" "\\1")
(:singular "\\(shoe\\)s$" "\\1")
- (:singular "\\(cris\\|ax\\|test\\)es$" "\\1is")
- (:singular "\\(octop\\|vir\\)i$" "\\1us")
- (:singular "\\(alias\\|status\\)es$" "\\1")
+ (:singular "\\(cris\\|test\\)\\(is\\|es\\)$" "\\1is")
+ (:singular "^\\(a\\)x[ie]s$" "\\1xis")
+ (:singular "\\(octop\\|vir\\)\\(us\\|i\\)$" "\\1us")
+ (:singular "\\(alias\\|status\\)\\(es\\)?$" "\\1")
(:singular "^\\(ox\\)en" "\\1")
(:singular "\\(vert\\|ind\\)ices$" "\\1ex")
(:singular "\\(matr\\)ices$" "\\1ix")
(:singular "\\(quiz\\)zes$" "\\1")
+ (:singular "\\(database\\)s$" "\\1")
- (:irregular "stratum" "strate")
+ (:irregular "person" "people")
+ (:irregular "man" "men")
+ (:irregular "child" "children")
+ (:irregular "sex" "sexes")
+ (:irregular "move" "moves")
+ (:irregular "zombie" "zombies")
+
+ ;; Additional rules that are not in ActiveSupport::Inflections
(:irregular "syllabus" "syllabi")
(:irregular "radius" "radii")
(:irregular "addendum" "addenda")
(:irregular "cactus" "cacti")
- (:irregular "child" "children")
(:irregular "corpus" "corpora")
(:irregular "criterion" "criteria")
- (:irregular "datum" "data")
(:irregular "genus" "genera")
- (:irregular "man" "men")
(:irregular "medium" "media")
- (:irregular "move" "moves")
- (:irregular "person" "people")
- (:irregular "man" "men")
- (:irregular "child" "children")
- (:irregular "sex" "sexes")
- (:irregular "move" "moves")
- (:uncountable "equipment" "information" "rice" "money" "species" "series" "fish" "sheep" "news"))
+ (:uncountable "equipment" "information" "rice" "money" "species" "series" "fish" "sheep" "jeans" "police"))
;;;###autoload
(defun inflection-singularize-string (str)

0 comments on commit e4f1372

Please sign in to comment.