// A news digest: each article's two key sentences for the e-mail, and the key sentences highlighted on the page.
//
//   quillo run summarize.qwe      then open http://localhost:8080/digest

use "summarize.qwer"

let ARTICLE = "The city council approved a new plan for electric buses on Tuesday. The plan replaces the diesel buses on twelve routes with electric buses by 2028. Council members said the electric buses will cut noise and air pollution in the city centre. The weather on Tuesday was mild, and the meeting started late. Charging stations for the buses will be built at the two main depots. The plan costs 40 million euros, half of it paid by a national grant for clean transport. Some residents asked whether the charging stations at the depots would be ready in time. The mayor thanked the staff for their work. Bus drivers will be trained to drive the electric buses next year."

route GET /digest {
    let ranked = summarize_ranked(ARTICLE, "en")
    {
        summary: summarize_text(ARTICLE, 2, "en"),
        third: summarize_ratio(ARTICLE, 0.34, "en")?,
        top: first(ranked),
        least: last(ranked).text,
        french: summarize_text("Le conseil a voté un nouveau budget pour les écoles. Le budget des écoles augmente de dix pour cent. Il faisait beau ce jour-là. Les écoles recevront le budget en janvier.", 2, "fr"),
    }
}
