Upgrade to Pro — share decks privately, control downloads, hide ads and more …

SA-aa-S: A Final Year Project

SA-aa-S: A Final Year Project

Lochemem Bruno Michael

August 07, 2019
Tweet

More Decks by Lochemem Bruno Michael

Other Decks in Programming

Transcript

  1. Sentiment Analysis as a Service A case study of Twitter

    Analytics Lochemem Bruno Michael United States International University - Africa
  2. Background Sentiment Analysis and related text-analysis techniques are available in

    many contexts Renowned projects like Google Cloud NLP and MonkeyLearn are popular SaaS options Custom NLP toolkits written in Python, Java, and Julia are also prominent The SA-aa-S project combines aspects of said Sentiment Insight acquisition techniques
  3. Problem Statement A great deal of opinions are pulsed through

    the internet - via Social Media - with great regularity There exists a need to classify - via appropriate annotation - said opinions The vastness of diverse text patterns warrants additional text analyses (collocation, keyword extraction)
  4. What the algorithm says Sentiment Positive Negative Neutral Compound mostly

    positive 0.247 0.097 0.657 0.8776 Compound score factors in intensity of all words
  5. A Simple Project A SA-aa-S project which offers Sentiment, Collocation,

    and Keyword analyses of Twitter text The app polls Twitter for text data; analyzes said data and conveys chart visuals to users authenticated via the platform
  6. Envisaged Benefits Automated text data consumption via daemon Quantification of

    word and emoticon intensity Algorithmic grading of phraseme relevance Algorithmic grading of collocations
  7. Development Challenges Difficulty writing a fault-tolerant long-running daemon Implementing synchronous

    Twitter OAauth in asynhronous environment Finding a compatible, comprehensive text analysis tool Writing performant code at all app tiers
  8. Salient Philosophies Functional Programming function jwtEncode(array $claims): string { $ret

    = _\compose( _\partial(_\extend, JWT_DEFAULT_CLAIMS), _\partialRight( Firebase\\JWT\\JWT::encode , JWT_SECRET ) ); return $ret($claims); }
  9. More stuff Asynchronous programming for potent I/O ... public function

    searchTweets( array $opts = [] ): PromiseInterface { $ret = _\partialRight(self::trimTweet, false); return $ret($this->_search( searchTweets , _\extend( $opts, [ include_entities => false, result_type => mixed ]) )); } ...
  10. Even more stuff State management for efficient data manipulation (Flux/Redux

    pattern) export let oauthLoginReducer = ( state = false, action ) => { switch (action.type) { case OAUTH_LOGIN_SUCCESS: return action.result case OAUTH_LOGOUT_SUCCESS: { const { result } = action if (has(result, [ token ]) && result.token) return false } default: return state } }
  11. More complicated? Virtual DOM-based UI rendering const LoadingPane: React.FC<LoadingPaneType> =

    ({ comp, tabId }) => ( <TabPane tabId={tabId}> <Loading classes="w-5 mx-auto" /> {comp} </TabPane> )
  12. How about some map-reduce? Tweet data tracking //map function (doc)

    { if (doc.created_at) { emit(new Date(doc.created_at).toDateString(), 1) } } //reduce function (keys, values, rereduce) { ... if (rereduce) { ret.total += values[acc].total ... } else { ret.total = sum(values) ... } ... }
  13. NLP, Anyone? Collocations via PMI function collocation(string $text): array {

    $ret = (new TokensDocument(_tokenize($text))) ... ->applyTransformation(new PunctuationFilter( PUNCTUATION_LIST )) ->applyTransformation(new StopWordsFilter( STOPWORDS_LIST )) ... return (new CollocationFinder($ret->toArray(), 3)) ->getCollocationsByPmi(); }