Skip to content

Turning In Text Mining Project#7

Open
tasandy wants to merge 2 commits intosd16fall:masterfrom
tasandy:master
Open

Turning In Text Mining Project#7
tasandy wants to merge 2 commits intosd16fall:masterfrom
tasandy:master

Conversation

@tasandy
Copy link

@tasandy tasandy commented Oct 3, 2016

No description provided.

Copy link

@runnersaw runnersaw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This review is intended to help you with writing readable and understandable code, not to evaluate or improve the functionality of your code.

Your code is generally very clear as to what it is doing. Variable names are very good, and indicate clearly what they hold. Your code could use some work to split up long chunks of code to make it easier for readers.

" count_negative = count_negative + 1\n",
" percent_positive = (count_positive/count_total)*100\n",
" percent_neutral = (count_neutral/count_total)*100\n",
" percent_negative = (count_negative/count_total)*100\n",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These three lines above can be outside of the for loop. You're overriding them each time and then doing nothing with the result until after the for loop

" print 'the number of tweets that have a positive sentiment is', count_positive, 'or', percent_positive, '%'\n",
" print 'the number of tweets that have a neutral sentiment is', count_neutral, 'or', percent_neutral, '%'\n",
" print 'the number of tweets that have a negative sentiment is', count_negative, 'or', percent_negative, '%'\n",
" #code for bar graph below using matplotlib python package\n",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's good coding practice to put a line of whitespace between parts of code that do different things. This is helpful visually for a reader. I'd suggest a newline before this comment and also maybe before the for loop above.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another alternative is to split this into two functions. One is return_sentiment_counts which returns a three-long list like [34,35,31], and one which is plot_results which takes the result of the previous and plots it. This will help you when reading and debugging code. (You could also create a function sent_analysis, which calls these two functions in the proper order.)

@runnersaw
Copy link

This is some final feedback about your first mini-project.

Fantastic report. The report covers all aspects and questions, with the right level of depth. It is clear that you were thoughtful when putting together the report.

The code runs without modification and implements all required functionality. I encountered an error that was likely due to unicode within one of the searched tweets (which was easily fixed using .encode(‘utf-8’)), but we're not expecting students to have written code to prevent this type of rare error.

Documentation is mostly absent. There is one comment that indicates the portion of the function that deals with plotting the data, but no other comments.

Variable and function names are well-chosen, and the code is largely organized logically. I would recommend that you split the code for searching Twitter and the code for plotting the results into two separate functions.

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