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

grep in Little Women (episode 7: Finding Things) #932

Open
OH-AU opened this issue Mar 13, 2019 · 2 comments

Comments

Projects
None yet
3 participants
@OH-AU
Copy link

commented Mar 13, 2019

To be ridiculously specific, the grep example in little women does not cover all cases (no pun originally intended) - Jo is mentioned a few extra times in headings as "JO"
A case insensitive search will yield slightly different results - it's arguable whether Titles/Headings should be included.
for sis in Jo Meg Beth Amy; do echo $sis:; grep -iow $sis LittleWomen.txt | wc -l; done
Jo:
1362
Meg:
686
Beth:
467
Amy:
652
for sis in Jo Meg Beth Amy; do echo $sis:; grep -ow $sis LittleWomen.txt | wc -l; done
Jo:
1355
Meg:
683
Beth:
459
Amy:
645
Not sure if either the examples or wording of the exercises should be made clearer.

@gdevenyi

This comment has been minimized.

Copy link
Contributor

commented Mar 13, 2019

Thanks for catching this.

This might be an interesting extension to discussing the importance of cAPiTALIzation. :)

@colinmorris colinmorris changed the title grep in Little Women grep in Little Women (episode 7: Finding Things) Apr 4, 2019

@colinmorris

This comment has been minimized.

Copy link
Contributor

commented Apr 4, 2019

Interesting observation! There are already a lot of variables to consider in this question (not counting names if they appear as a substring of a larger word, counting them if they have punctuation or a clitic attached, counting multiple appearances on one line...), so I don't think I'd want to emphasize this as another strict condition for correctness. But could definitely imagine mentioning it in a postscript to the solution. e.g.

Perceptive observers may have noticed that character names sometimes appear in all-uppercase in chapter titles (e.g. "MEG GOES TO VANITY FAIR"). If you wanted to count these as well, you could add the -i option for case-insensitivity. (Though in this case, it doesn't affect the answer to which sister is mentioned most frequently.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.