Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func PrintAnalysis ¶
func PrintAnalysis(posts []RedditPost)
PrintAnalysis prints the results of the posts from the Sentiment Analysis api
func PrintSentimentChart ¶
func PrintSentimentChart()
PrintSentimentChart prints the sentiment analysis chart
Types ¶
type Analysis ¶
type Analysis struct { Score float32 `json:"score"` ParsedSentiment string `json:"parsedSentiment"` }
Analysis hold the results from the sentiment analysis from Google's API
type Posts ¶
type Posts struct { HotPosts []RedditPost `json:"hot_posts"` TopPosts []RedditPost `json:"top_posts"` }
Posts a wrapper struct around the Hot and Top posts that help parse the scraped Reddit posts in this repo
type RedditPost ¶
type RedditPost struct { Title string `json:"title"` Score int `json:"score"` ID string `json:"id"` URL string `json:"url"` CommentCount int `json:"comms_num"` CreatedAt float32 `json:"created"` Body string `json:"body"` Timestamp float32 `json:"timestamp"` // same as CreatedAt Comments []string `json:"comments"` Analysis Analysis `json:"analysis"` }
RedditPost is the struct of a reddit post pulled from this repos' scraped post
func AnalyzePosts ¶
func AnalyzePosts(ctx context.Context, client *language.Client, posts []RedditPost) ([]RedditPost, error)
analyzePosts send each reddit post's body to Google's api for sentiment analysis mutates each post's Analyze.Score property and return the posts and no error if an error is present then empty posts and nil
Click to show internal directories.
Click to hide internal directories.