Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Method to make things possessive and visa-versa (Possessivize?) #370

Open
davidmurdoch opened this issue Dec 31, 2014 · 8 comments
Open

Comments

@davidmurdoch
Copy link

var name = "Jesus"
var message = string.Format("It is {0} birthday!", name.Possessivize());
// message == "It is Jesus' Birthday"

var name = "David"
var message = string.Format("It is {0} birthday!", name.Possessivize());
// message == "It is David's Birthday"

Of course, I know different style guides treat possessive forms differently, so this would need to have a configuration option.

For instance:
Some style guides the possessive form of Illinois should be Illinois' because it ends with an s, some say it should be Illinois's because all possessive nouns get the 's treatment, some say it should be Illinois's because the "s" is silent, thus the "s" in the `'s' would be pronounced.

I imaging it can get even stranger if you want a possessive plural (proper) noun that ends with an s, like Jones, e.g., "Let's go to the Joneses' house".

Note: I can't think of a word denotes the opposite of being possessive.

@mistakenot
Copy link

I'm happy to have a run at this, something like:

  1. Short list some frequent possessive pronouns to leave as is such as his, hers, ours, theirs etc.
  2. Add apostrophe for plural possession or words that end in s e.g Jones -> Jones', girls -> girls'
  3. Everything else, add 's.

I can't help but feel that worrying about edge cases like Illinois would just end in one having a massive list of exceptional words and be a bit messy, unless we can summarize this into a limited set of rules.

@MehdiK
Copy link
Member

MehdiK commented Jan 28, 2015

Thanks. Yes, please go for it.

A few thoughts:

  • We do need the exception list.
  • We need complete test coverage for all the covered cases and exceptions.
  • Checkout the Inflector extensions as it could be relatively similar.
  • Please don't call it Possessivize! ;) Let's discuss a good name for it. Maybe ToPossessive?!

Please follow the contribution-guideline.

@mistakenot
Copy link

Could the VS project benefit from a top level "Grammar" folder to keep this and similar tools in?

@MehdiK
Copy link
Member

MehdiK commented Jan 29, 2015

We have kept all the extensions on the root and I don't think the current structure has grown beyond maintainability/readability. Having Grammar on the root is not such a bad idea; but I don't think that grouping provides much value.

The other concern is that it could confuse namespace generation and we could accidentally release a new version of the lib with extensions moved into a different namespace and effectively breaking all the callers - this is not hypothetical. I have made this very mistake on another OSS of mine :/

My vote is no. What do @mexx and @hazzik think?

@mexx
Copy link
Collaborator

mexx commented Jan 29, 2015

As @MehdiK already said, the structure is quite maintainable at the moment.
I also actually don't see much benefit in adding that folder.

@hazzik
Copy link
Member

hazzik commented Jan 29, 2015

I vote "no" for now. @MehdiK

@mistakenot
Copy link

Is there a preference for how to specify rule exceptions, i.e. XML, static arrays... ?

@MehdiK
Copy link
Member

MehdiK commented Apr 17, 2015

@mistakenot Arrays. Everything should be doable in POCO. No config files please.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants