Skip to content

Conversation

bmistree
Copy link
Contributor

I enjoyed your talk today. Here's my 1-line version of the word frequency counting program. A couple of notes:

  1. I hard-coded the file that the program operates over. If I took the file as a command line argument, I know this would work in 2 lines, and there still may be a weird way to get it to work in one
  2. If it'd be helpful, I'd be happy to create an alternate version that's split into several files/functions to explain what the code is actually doing.

Please let me know what you think. Thanks!

@bmistree
Copy link
Contributor Author

Just wanted to follow up on the first point above (hard-coding the file that the program operates over): I think I can keep this as a single line program and take in the filename as a command line argument if I use import in a weird way. Let me know if you want me to give that a shot. Thanks again!

@crista
Copy link
Owner

crista commented May 20, 2016

hahaha. Very cool!
Wanna try getting the file name from the command line? As is, it's already hard enough to understand, so another trick won't matter much!

Previously, I had hard-coded this. This commit also makes it so that
the script can be executed from any current working directory and
(hopefully) makes it platform agnostic by using os.path.join to build
the path to the stop words file.
@bmistree
Copy link
Contributor Author

I think that this change should take the filename as a program arg. It also makes it so that you can execute the script from any directory. This was fun, let me know if you think any other changes would be helpful. Thanks again!

@crista crista merged commit d521abd into crista:master May 21, 2016
@crista
Copy link
Owner

crista commented May 21, 2016

Cool! 👍
People will enjoy seeing this.

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

Successfully merging this pull request may close these issues.

2 participants