LoginSignup
11
12

More than 5 years have passed since last update.

言葉の単数形と複数形の変換

Last updated at Posted at 2017-07-03

inflectionが便利

install

pip install inflection

使い方

import inflection as i


print("pluralize", i.pluralize("dog"))
print("singularize", i.singularize("dogs"))

# pluralize dogs
# singularize dog

利用例

複数形になっているテーブル名からクラス名のようなものを作りたい場合に

print(i.camelize(i.singularize("cats")))
# Cat
11
12
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
11
12