Page MenuHomePhabricator

[GSoC Proposal 2017] Wikimedia Emoji Twitter Bot for Commons Images
Closed, DeclinedPublic

Description

Project Title

Wikimedia Emoji Bot for Commons Images

Personal Information

Name: Alangi Derick Ndimnain
Email: alangiderick@gmail.com
IRC Nick: d3r1ck
Github: Github Profile Page
Meta: Meta User page

Project Mentors

Primary mentor: @Dereckson and @ArielGlenn
Co-mentor: we may add a co-mentor, tbd, @MelodyKramer expressed interest
Support: @Yurik for JavaScript/Node-specific issues

Synopsis / Project summary

Wikimedia Emoji Bot project is a project meant to provide access to Twitter users to get Commons images counterparts of tweeted emojis. So basically, when a Twitter user tweets a valid emoji ( say: Smile Emoji 😊 ), the bot should reply the user's tweet with a Wikimedia Commons image (randomly selected from a smile domain space of images) corresponding to someone smiling. In addition, the bot should also be able to interpret text based emojis like this ( ^-^ ), then match it to a corresponding commons image.

Why this project?

Wikimedia Commons usually has very beautiful pictures that people might want to see all over the world, with this project, text/gif based communication with a bot like this can reveal some very beautiful pictures on Commons making people aware of a platform like this, hence, increasing Wikimedia Common users so they can also add more pictures to the platform. In addition, with this project and Twitter as a platform that powers many users, this is an opportunity to increase awareness of Twitter users to know about the Wikimedia movement and its projects (and how they can use it to impact themselves and their community), hence, fulfilling the goal of the movement.

The project can be executed in 3 months and will benefit the community in the sense that more users will aware of what commons is all about and hence likely to contribute to it making this project a valid GSoC project (based on its scope). It's not impossible to complete the project in this time frame (3 months), this doesn’t mean that the project is simple/easy. This is just the time a GSoC participant can use to execute a project as such.

Why me for this project?

My contributions to Wikimedia has been for over 1.5 years now in various perspective spanning from community building to technical (contributions). From a software engineering background and with a previous year experience in GSoC 2016, I have the capability to execute this project and determined to learn additional skills that might be needed in the project that I don’t yet have at this moment (during the community bonding period). Also, with my programming experience of over 7 years and working with web applications and other related projects including my previous GSoC project that was a web service application to connect Wikidata APIs with IFTTT (IF This Then That) API and this project is similar in the sense that I will be working with a web service to connect Twitter’s API with Wikimedia Commons. This experience puts me in the position to complete this project during the summer. I have already started doing some work on the project so far on the NYPL fork and you can check the repo below.

In addition, I just recently built a Node JS Twitter bot to retweet and like tweets with my account matching particular keywords; the keywords I used are; “#wikimedia”, “#wikipedia”, “@mediawiki” etc… I am making it Wikimedia related to keep the culture running. Its successfully deployed and running on WM tool labs, you can check here: Codes on Github and the application is running successfully on tool labs (with name "wiki-retweet-bot") and does like and retweet for me matching the keyword(s). With this clear cut knowledge from developing a small bot to deployment and see it work using the Twitter APIs.

Project repository

  • Github link to the project (as at now): Wikimedia Emoji Bot project on Github but Gerrit will be used for development of this project.
  • So far, some pre-requisite work has been done on the project such as; configs, documentation and basic setup has been tackled on the repo.
  • The project has been hooked up for Continuous Integration (CI) testing on Travis and builds are passing.

Project goals

  • Valid Twitter account for the bot called: Wikimedia-Emoji-Bot.
  • Bot replies user's tweet with an image from commons.
  • Bot should not reply to blocked emojis.
  • Project codes should have Travis continuous integration testing.
  • Code base should be hosted in the Wikimedia organisation GitHub.
  • Bot should run on Wikimedia Tool Labs for online testing by community members.
  • 300 acceptable emojis and 50 blocked emojis.
  • 3000 Wikimedia commons images since an emoji will be mapped to at least 10 images.
  • Developers manual on how to contribute which will be a wiki page.
  • Project report with full description on how the project was done from beginning to finish.

Detailed project description

Introduction

This project seeks to solve a problem of getting corresponding Wikimedia Commons images when its emoji counterparts are tweeted on Twitter. In the project, I am expected to build a bot (Wikimedia Emoji Bot) that receives an emoji based tweet on Twitter and responds / replies to the tweet with an image from wikimedia commons that matches the properties of the emoji. So for example, if the emoji of the sender is a smile(😊), the response of the bot will be some image with a person with smiling face. Another example can be an angry(😣) emoji and the response would be an image of a person having an angry face. So, they key here is that the image in response should have the properties of the senders emoji. Also, another key part is that the image in response must come from Wikimedia commons.

Implementation Approach

Creating a Twitter developer app

Before creating a Twitter bot, we need to use the Twitter developer website to create an application instance that the bot will connect to before processing the request and responding to Twitter. The developer Twitter app has credentials that the bot will be use to authenticate (which will be used to access the Twitter API) for example; TWITTER_CONSUMER_KEY, TWITTER_CONSUMER_SECRET etc..

Internal structure of the emoji to image data set

The approach that will be used is crowd-working in which pictures will be selected and loaded up to a JSON file which emojis are mapped to and visualising the idea, have a look at the snippet below;

{
    "emoji-1": [
            "image-1",
            "image-2",
            "image-3"
         ]
}

We would want to have many images mapped to one emoji to make it more fun so users have different images when a particular emoji is tweeted so that the application response all of a sudden won't easily be predictable at different instances.

Flow of the application
  • When a Twitter user makes a tweet to the bot, the bot will start a process of trying to connect and authenticate to Twitter via the credentials of the developer’s Twitter APP ID.
    • The essence of the connection and authentication is to make sure the bot is using a valid account and valid credentials to perform the operations and make use of the Twitter API.
  • Once connection is established, the bot will read the emoji that is sent by the user and parse the JSON file checking to find a match in the JSON file of emojis mapping to images and also making sure that the emoji in concerned is not in the list of blocked emojis.
  • If the emoji is acceptable and there is a match in the JSON file, there will be a getRandom() method in an Image class to return a random image (image url to be specific) from the emoji’s image space and store in a variable.
  • The bot then makes a response by replying to the senders tweet with a URL that will be seen as a reply to the tweet of the user, then the user can click on the link and he/she is taken to commons to view the image. Will work with the commons community to do this task: T63487(depending on their response) or use an alternative method to preview the image in the URL.

Development Schedule / Timeline

This is a plan that will be used during the GSoC period but can be slightly modified as GSoC proceeds

  • May 4 - May 17 (2 weeks)
    • Analysis on which crowd-working approach to use in the implementation of the bot, as there are several approaches to be used but at the end of the project, the most important in terms of time and space (with greater advantages) should be used.
    • Request a Gerrit repo for this project.
    • Develop a report on the analysis as part of the project's reporting.
    • Searching APIs and/or libraries that might be useful for this project completion and what they are used for. Also, similar bot and see how they are implemented.
    • Start working on ticket: T63487 or an alternative approach.
  • May 18 - May 30 (1.6 weeks)
    • Discuss with mentors on development strategies (based on analysis) of the project and the approach to use in implementing the Wikimedia Emoji bot.
    • Read docs related to Twitter API in relation to Node JS and understand the NYPL Emoji bot application implementation (code base).
  • June 1 - June 10 (1.3 weeks)
    • Build a simple prototype of the application with 5 emojis and 10 commons images.
    • The prototype will implement the agreed approach for the application.
    • Documentation and reporting of the prototype and testing.
  • June 11 - June 25 (1.1 weeks)
    • Compile a list of acceptable emojis (as much as possible) that will be used in by the bot.
    • Compile a list of non-acceptable emojis (as much as possible) that will be considered by the bot.
    • Documentation and reporting.
  • June 26 - June 30 (5 days)
    • First Evaluations
  • June 30 - July 13 (2 weeks)
    • Compile a list of Images that will be used by the bot and making to an emoji should have at least 10 images in its image space. This is to make sure that images hardly repeat in responses when the same emoji is tweeted.
    • Documentation and reporting.
  • July 14 - July 23 (1.3 week)
    • Building the JSON structure to map each emoji to its images counterpart and making sure to respect the emoji to image properties.
    • Documentation and reporting.
  • July 24 - July 28 (5 days)
    • Second Evaluations
  • July 28 - August 10 (2 weeks)
    • Write automated tests to test all various functionalities of the application which will consist of scripts to test; postTweet(), replyTweet(), randomImage(), etc.. All the various components of the application will be tested.
    • Documentation and reporting.
  • August 11 - August 20 (1.4 weeks)
    • Deployment of the application on Wikimedia Tool Labs (test instance) so that members of the community can test and give feedback for improvement.
    • Creating of an official Wikimedia repo (in the Wikimedia Organisation on Github) for this project so that other can contribute and development will continue after GSoC.
    • Documentation and reporting.
  • August 21 - August 29 (1.1 week)
    • Pencils Down, Code clean up.
    • Improve and review documentation.
    • Final evaluation, Submission of code to Google.

Work after GSoC 2017 on the project

This is a long term project and will need needs improvement after the GSoC period as more images on Commons keep adding (matching emojis) and also more emojis keep coming up every single day. After GSoC, emojis (new or old) that don't yet have a commons picture counterpart will be filled up and new features will be added to the bot. And maybe in the future, some AI algorithms will be used to populate the JSON file of emojis to commons images.

Time Availability during GSoC

I would put in 45 hours per week on this project and will be coding during weekends (occasionally), regularly informing my mentors on my progress and regularly updating my wiki report page or phabricator ticket of the project (reporting). I will mostly be programming in the evenings due to school during the day but if working on Saturdays and/or Sundays, I will probably be programming throughout (day and night).

Why Wikimedia Foundation (WMF)?

Wikimedia Foundation is an organisation which focuses on encouraging the growth, development and distribution of free, multilingual, educational content, and to providing the full content of these wiki-based projects to the public free of charge. This is an organisation worth working with to make my continent (Africa) especially Cameroon to be sensitised about such opportunity of the sum of all free knowledge. This will go a long way to improve my community and Africa including the world as a whole in terms of education and academics "for free". Since the African community is somewhat lacking in the global movement, this is the reason why I decided to forge into the movement, hence filling the gaps.

My Contributions (technical) to Wikimedia

  • Since I joined the Wikimedia in September 2015 till now, I have contributed in several ways in the promotion of this organisation both in coding, mentoring outreach programs and also in community perspective by being one of the leaders of a Wikimedia User Group in my country.
  • Coding related, I have dozens of cycles of merged patch sets spanning various extensions, check: here.
  • Currently, I am coaching a team of female developers hoping to participate in the RGSoC program in Wikimedia.
  • For more about my contributions, check the About me section below.

My works (personal and Wikimedia related)

  • As a fan of Github, most of my codes lives there, below is a list of few projects I have built and deployed which are running live;
    • Wikipedia RSS Feeds: Part of my GSoC 2016 project to list RSS feeds for various Wikipedia triggers which can then be used in an RSS feed reader for information update.
    • Wiki Retweet Bot: Node JS application (bot that uses Twitter APIs) to do most recent retweets and likes with my twitter account for tweets matching keyword(s) like; "#wikimedia", "MediaWiki-General" etc...
    • URL Shortener: A PHP based simple URL shortener application that is deployed on tool labs.
    • eFarm.cm: An agricultural web / mobile platform to sell and buy agricultural products. You can access the platform here to test the beta version.
    • Worked on an Eggdrop bot for our channel #ublab and customised it to suite our needs, adding Tcl Scripts to add more features to the bot and Here the codes.

About me

  • I'm an active member and an organiser for the Google Developer Group in our community (Buea). I have participated in various GSoC(Google Summer of Code) meetups organised in our community to sensitise and mentor young, talented and motivated students to contribute to Open Source movements.
  • Elite Programmers Club is a club that was founded in my University to teach, enhance and empower programming skills to interested students, and I am an admin and mentor in the club and it's Facebook page with Freenode IRC channel: #ublab (and me as channel operator).
  • Holder of a Computer Engineering degree (BEng), specialising in Software Engineering from the University Of Buea and currently and Masters student in Software Engineering.
  • Have been contributing to WMF for about over 1.5 years now and here are my contributions, where I have contributed patches across many different extensions.
  • GSoC participant for 2016 where I worked on a project to connect IFTTT API and the Wikidata APIs(T118463). I am so thankful to my mentors (@Slaporte, @Lydia_Pintscher, @hoo and @Bene) for their great efforts they put in so I could complete this project in the end of GSoC 2016.
  • Obtained a full scholarship to attend a Wikimedia Conference (WikiIndaba 2017) in Ghana.

My programming skills and qualifications

  • Technical Skills
    • Programming Languages: JavaScript, JSON, PHP, Python.
    • Software Tools: NPM(Node Package Manager), Secure Shell, Git/Github, Gerrit, Wikimedia Tool Labs & Phabricator.
    • Frameworks: Node JS, jQuery, Vue.js
  • Hour of Code Certified, view certificate here.
  • Participated in the ACM ICPC contest in 2014, and here is my membership card.
  • Google Code-In 2015 and 2016 mentor under Wikimedia and also Google Summer of Code 2016 student participant under Wikimedia, view certificate here.

Event Timeline

xSavitar updated the task description. (Show Details)
xSavitar updated the task description. (Show Details)
xSavitar renamed this task from [GSoC Proposal 2017] Wikimedia Emoji Bot for Commons Images to [GSoC Proposal 2017] Wikimedia Emoji Twitter Bot for Commons Images.Mar 24 2017, 3:00 PM
xSavitar updated the task description. (Show Details)
xSavitar updated the task description. (Show Details)
xSavitar updated the task description. (Show Details)

Marking this as Declined since the proposal wasn't selected for Google-Summer-of-Code, but can be reopened if need arises. Thanks.