1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
extern crate tokio;

const URL: &'static str = "http://esummarizer.com/main/getsummary";

#[tokio::main]
pub async fn summarize_text(text: &str) -> String {
    let params = [
        ("text", text),
        ("nbsentences", "5")
    ];
    let client = reqwest::Client::new();
    client.post(URL)
        .form(&params)
        .send()
        .await
        .unwrap()
        .text()
        .await
        .unwrap()
}