Most of bank websites (in France at least) provide .QIF downloads, so I coded a tool to semi-automatically add categories to qif transactions by matching keywords from your past transactions history : https://github.com/Kraymer/qifqif
I use it with GnuCash but could work with ledger as long as ledger importer links categories with accounts.