📜 ⬆️ ⬇️

Anime search bot

Hello. I am writing this article as a guide for using my chat bot - Animeshnitsa Foxy and for a portfolio.

What tasks does


Bot created as an alternative to search engine. He is able to analyze your text, determine the criteria for selection and produce a result.

What can


Define search parameters


The search result is based on the following parameters:
  1. Genre.
  2. Type (series, feature film, special issue, ova, ona).
  3. Age restrictions.
  4. The amount of anime in response.
  5. Sorting.


For each parameter, with the exception of a quantity, there is a dictionary with definitions and their synonyms with which the user's text is associated.
')
Also, the Number and Sort parameters have default values: 3 and random, respectively.

Examples


Search by genre
Comedy
Fun anime
Something funny

Result:
{ "limit": "3", "kind": [], "genre": [ "" ], "order": "random", "rating": [] } 


Also, there may be several genres:
Very funny anime or something scary

Result:
 { "limit": "3", "kind": [], "genre": [ "", "" ], "order": "random", "rating": [] } 


Search by type
Full length movie
Film

Result:
 { "limit": "3", "kind": [ "" ], "genre": [], "order": "random", "rating": [] } 

Search by age limit
R +
Anime for adults

Result:
 { "kind": [], "genre": [], "order": "random", "rating": [ "r_plus" ], "limit": "3" } 

Sorting
Top anime
Best anime

Result:
 { "genre": [], "order": "ranked", "rating": [], "limit": "3", "kind": [] } 

Combining parameters
top 5 anime horror

Result:
 { "kind": [], "genre": [ "" ], "order": "ranked", "rating": [], "limit": 5 } 

1 new movie

Result:
 { "kind": [ "" ], "genre": [], "order": "aired_on", "rating": [], "limit": 1 } 

5 latest serials or ova in the comedy rated R

Result:
 { "genre": [ "" ], "order": "aired_on", "rating": [ "r" ], "limit": 5, "kind": [ "", "OVA" ] } 


Search by name


If the text could not be disassembled into parameters, the bot will attempt to analyze the presence of the title of a particular title. And returns information about him, as well as several related or similar anime.

Unlike the search by parameters, here, in addition to the dictionary with the names of all the anime, you can search by preset patterns and have your own name.

Examples


Anime with the name of Van Pees

Result:
 { "name": " " } 

Find me an anime like Van Pic

Result:
 { "name": " " } 

Anime van pic

Result:
 { "name": " " } 


Other


In addition to the request itself, the bot is able to maintain context and link several consecutive requests:
1 best series

Result:
 { "kind": [ "" ], "genre": [], "order": "ranked", "rating": [], "limit": 1 } 

and the movie?

 { "kind": [ "" ], "genre": [], "order": "ranked", "rating": [], "limit": 1 } 

still

Result:
 { "kind": [ "" ], "genre": [], "order": "ranked", "rating": [], "limit": 1, "page":2 } 

As you can see, even in subsequent requests there is no explicit indication of the type and limit, the bot saves these parameters from the first request, thereby forming the context of the dialogue.

Read more about the syntax analysis here .

PS And, Another bot can not beautifully snap, if you insult her.

Source: https://habr.com/ru/post/350498/


All Articles