How we use the Giphy API for thematic GIFs in the football status bot
In our free time, our analytics department grows a bot that finds interesting patterns in football statistics and writes statuses about it on Sports.ru . The name of the robot is FRED, it turns out something like this: The

creativity of the robot is not yet diverse (there are only a couple of dozen types of facts), but the frame is already ready. The basic model is as follows:
1. Once an hour, a Python script is launched that analyzes the upcoming football matches, if any.
2. The script considers all possible facts for teams playing in the selected matches, using reports on teams and players from our database.
Each type of fact has its own function of interest, which depends on the content of the fact (goals are more interesting than cards and substitutions), its extremality (to score ten games in a row is more interesting than five) and the popularity of teams and tournaments on the site.
3. Of all the facts, the three most interesting ones are selected, which are posted via the API to Sports.ru status feed and to Twitter. Only particularly interesting facts can get into Sports.ru general tapes (with all new statuses), the rest are visible only to subscribers.
Improvement with the help of “add-ons”
The first experiments of the robot looked unconvincing: the monotonous facts looked boring (all the more so because at times Fred gets somewhere in gibbling football). He definitely lacked emotion and diversity.
To begin with, we decided to add to the facts “punchline”: the word-completion at the end, emphasizing the emotion of the statement. This manner in football was popularized by Opta, which provides statistics, including for Sports.ru. Of course, Opta accounts are maintained by real people .
We have nine categories of possible punchlines. Each type of fact has its own category, but sometimes extras of other types are taken, so an additional comic effect is created. Scriptwriters know that an interesting scene is one in which not what the audience expected, but the integrity of the world of the work is preserved. The larger the gap between expectation and the actual outcome, the more interesting. The robot, of course, does not post completely random words (then the integrity disappears and the mechanical nature of the utterance becomes too obvious), but sometimes write "What is the point?" after the phrase about the series of victories for Spartak, it’s quite funny.
GIF Improvement
But we wanted to make the robot even more interesting, if only because it is not smart enough to entertain with statistics. In Sports.ru statuses it’s convenient to watch gifs, so we decided to illustrate the facts with their help. However, themed gifs are almost impossible to find (there are almost none even about the players of the Russian championship), so we turned again to the emotions of the statements.
A fixed list of gifs is similar to the punchline dictionary, however, I did not want to do it. Gifs quickly become boring, they need to be assembled for a long time and need to be changed regularly - that means this solution does not scale well (ideally, the robot should work for different countries and in different languages). Fortunately, there is a Giphy project with a large database of well-trained and suitable GIF format - and, which is especially great, Giphyhas its own free API .
Now the robot, placing the status, accompanies it with something random from fresh gifs - for example, with the fail or wtf tags . The combination of fact, punchline and GIF allows you to often generate statuses that turn out to be statements by themselves. For example, such :

In the worst case, the robot, as if the SMM manager has broken the chain, decorates the tape with random gifs. Perhaps, with the development of the actual extraction of patterns, we will refuse additional decorations, but so far the gifs stimulate at least the employees involved in the project.

What we plan to do with Fred further:
1. Seriously expand the number of possible facts.
2. Use for the training of the bot the activity of its subscribers who comment, like and repost successful statuses.
3. To propagate it for our projects in different countries, taking into account regional characteristics.
We will be happy to answer questions and accept proposals for the development of the status bot.

creativity of the robot is not yet diverse (there are only a couple of dozen types of facts), but the frame is already ready. The basic model is as follows:
1. Once an hour, a Python script is launched that analyzes the upcoming football matches, if any.
2. The script considers all possible facts for teams playing in the selected matches, using reports on teams and players from our database.
Each type of fact has its own function of interest, which depends on the content of the fact (goals are more interesting than cards and substitutions), its extremality (to score ten games in a row is more interesting than five) and the popularity of teams and tournaments on the site.
3. Of all the facts, the three most interesting ones are selected, which are posted via the API to Sports.ru status feed and to Twitter. Only particularly interesting facts can get into Sports.ru general tapes (with all new statuses), the rest are visible only to subscribers.
Improvement with the help of “add-ons”
The first experiments of the robot looked unconvincing: the monotonous facts looked boring (all the more so because at times Fred gets somewhere in gibbling football). He definitely lacked emotion and diversity.
To begin with, we decided to add to the facts “punchline”: the word-completion at the end, emphasizing the emotion of the statement. This manner in football was popularized by Opta, which provides statistics, including for Sports.ru. Of course, Opta accounts are maintained by real people .
We have nine categories of possible punchlines. Each type of fact has its own category, but sometimes extras of other types are taken, so an additional comic effect is created. Scriptwriters know that an interesting scene is one in which not what the audience expected, but the integrity of the world of the work is preserved. The larger the gap between expectation and the actual outcome, the more interesting. The robot, of course, does not post completely random words (then the integrity disappears and the mechanical nature of the utterance becomes too obvious), but sometimes write "What is the point?" after the phrase about the series of victories for Spartak, it’s quite funny.
GIF Improvement
But we wanted to make the robot even more interesting, if only because it is not smart enough to entertain with statistics. In Sports.ru statuses it’s convenient to watch gifs, so we decided to illustrate the facts with their help. However, themed gifs are almost impossible to find (there are almost none even about the players of the Russian championship), so we turned again to the emotions of the statements.
A fixed list of gifs is similar to the punchline dictionary, however, I did not want to do it. Gifs quickly become boring, they need to be assembled for a long time and need to be changed regularly - that means this solution does not scale well (ideally, the robot should work for different countries and in different languages). Fortunately, there is a Giphy project with a large database of well-trained and suitable GIF format - and, which is especially great, Giphyhas its own free API .
Now the robot, placing the status, accompanies it with something random from fresh gifs - for example, with the fail or wtf tags . The combination of fact, punchline and GIF allows you to often generate statuses that turn out to be statements by themselves. For example, such :

In the worst case, the robot, as if the SMM manager has broken the chain, decorates the tape with random gifs. Perhaps, with the development of the actual extraction of patterns, we will refuse additional decorations, but so far the gifs stimulate at least the employees involved in the project.

What we plan to do with Fred further:
1. Seriously expand the number of possible facts.
2. Use for the training of the bot the activity of its subscribers who comment, like and repost successful statuses.
3. To propagate it for our projects in different countries, taking into account regional characteristics.
We will be happy to answer questions and accept proposals for the development of the status bot.