Git Product home page Git Product logo

inflection's Introduction

inflection(Just for learning)

Inflection pluralizes and singularizes English nouns implemented by rust.

Copy from go version.

use inflection::{singular, plural};


assert_eq!(plural::<_, String>("person"), "people".to_string());
assert_eq!(plural::<_, String>("Person"), "People".to_string());
assert_eq!(plural::<_, String>("PERSON"), "PEOPLE".to_string());
assert_eq!(plural::<_, String>("bus"), "buses".to_string());
assert_eq!(plural::<_, String>("BUS"), "BUSES".to_string());
assert_eq!(plural::<_, String>("Bus"), "Buses".to_string());
assert_eq!(plural::<_, String>("FancyPerson"), "FancyPeople".to_string()); 
                                                                             
assert_eq!(singular::<_, String>("people"), "person".to_string());           
assert_eq!(singular::<_, String>("PEOPLE"), "PERSON".to_string());           
assert_eq!(singular::<_, String>("buses"), "bus".to_string());               
assert_eq!(singular::<_, String>("People"), "Person".to_string());           
assert_eq!(singular::<_, String>("BUSES"), "BUS".to_string());               
assert_eq!(singular::<_, String>("Buses"), "Bus".to_string());               
assert_eq!(singular::<_, String>("FancyPeople"), "FancyPerson".to_string()); 

inflection's People

Contributors

bestgopher avatar

Stargazers

 avatar

Watchers

 avatar

inflection's Issues

API is awkward

The README says this is just for learning, but I'm having trouble finding another inflection library that I'm happy with. Would you be interested in maintaining this for actual production use, with a little help?

I'd suggest as a start changing plural and singular to just always produce a String. The extra genericness doesn't add any efficiency, and makes it more cumbersome to use, rather than easier.

Let me know if a pull request would be appreciated.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.