Is that word Feminine or Masculine?

12

Write a program or function that takes in a single string containing only lowercase a-z, and prints or returns a truthy value if the word is the feminine version of the thing it represents and a falsy value if it is the masculine version. For example, hen is the feminine version for chicken and rooster is the masculine version, so hen might produce 1 and rooster might produce 0.

Doing this for all English words that reflect gender would of course be way too unwieldy. Your program/function only needs to support 20 masculine/feminine pairs. Below are five sets of 10 masculine/feminine pairs, categorized by topic. Choose any two of the sets; the 20 total pairs in these two sets are the 40 words your program/function must work for.

(format is masculine_version feminine_version)

  1. General

    he she
    him her
    man woman
    boy girl
    male female
    masculine feminine
    guy gal
    lad lass
    mister miss
    sir madam
    
  2. Familial

    father mother
    dad mom
    pa ma
    son daughter
    brother sister
    husband wife
    grandfather grandmother
    grandpa grandma
    uncle aunt
    nephew niece
    
  3. Animal

    lion lioness
    rooster hen
    stallion mare
    bull cow
    drake duck
    boar sow
    buck doe
    ram ewe
    gander goose
    billy nanny
    
  4. Royal

    king queen
    prince princess
    emperor empress
    duke duchess
    marquess marchioness
    earl countess
    baron baroness
    baronet baronetess
    lord lady
    knight dame
    
  5. Fantastical

    wizard witch
    giant giantess
    incubus succubus
    nidorino nidorina
    nidoking nidoqueen
    ents entwives
    hanuvoite inimeite
    centaur centaurides
    merman mermaid
    khal khaleesi
    

So, for example, you might choose the General and Familial categories. Then any input from he to sir or father to nephew would produce a falsy value, and any input from she to madam or mother to niece would produce a truthy value.

The values don't all have to be the same truthy/falsy type, e.g. he might produce 0 but sir might produce false. You may assume only the 40 specific lowercase a-z words from your two selected categories are ever input.

The shortest answer in bytes wins. Tiebreaker is earlier post.

(This challenge is not meant to correlate with or make statements about any current gender-based social issues.)

Calvin's Hobbies

Posted 2015-05-04T05:19:26.367

Reputation: 84 000

1Related. – Martin Ender – 2015-05-04T11:06:58.273

Shouldn't count be the masculine of countess? – mbomb007 – 2015-05-04T14:39:03.193

@mbomb007 Not necessarily.

– Calvin's Hobbies – 2015-05-04T15:45:11.560

3Three answers, all Retina. – Alex A. – 2015-05-04T23:26:22.830

Answers

9

Retina, 26 bytes (sets 4, 5)

[^u]es|ee|m.i|y|^...c|d.*a

Retina is @MartinBüttner's regex language. I haven't used anything specific to .NET regexes, so you can test the regex at Regex101 here. Alternatively you can use Retina's grep G mode like so:

G`[^u]es|ee|m.i|y|^...c|d.*a

and pipe in a file with one word per line for batch testing.

Retina outputs the number of matches by default, giving us our truthy/falsy value. The rule "the values don't all have to be the same truthy/falsy type" is pretty important though since marchioness matches twice, giving an output of 2.

(Using the mod-chaining method from the previous male/female question seems to be shorter in CJam, but I'll let someone else do that)

Sp3000

Posted 2015-05-04T05:19:26.367

Reputation: 58 729

2time is never wasted on a regular expression – CousinCocaine – 2015-05-04T11:34:08.913

3

Retina, 39 32 bytes (sets 2, 4)

Accounting for marquess was annoying, since using ma was the best way to get some of the feminines.

[^u]es|ma$|mo|y|[mie]e|wi|ter|au

Try it here

Thanks to Sp3000 for his golf suggestion.

mbomb007

Posted 2015-05-04T05:19:26.367

Reputation: 21 944

With a little rearranging – Sp3000 – 2015-05-04T16:37:57.657

@Sp3000 Ah, thanks. I hadn't noticed I could use $ for that. – mbomb007 – 2015-05-04T16:40:15.783

2

Retina, 28 bytes (sets 3,4)

w|[mhorse]e|[^u]es|duc|[dn]y

Retina uses .NET regex, but any flavor should work. Test it at Regex101.

NinjaBearMonkey

Posted 2015-05-04T05:19:26.367

Reputation: 9 925