No, you can not choose a swarm
The simplest argument is that the Ranger must choose a beast, singular, not a swarm of beasts, plural. Jeremy Crawford even supports this interpretation (although in this case referring to Wild Shaping druids.)
Natural vs unnatural
There are also additional arguments to be made against a swarm being a valid option.
For example, consider the description of the Beast type, in the Monster Manual:
Monster Manual p6
Beasts are nonhumanoid creatures that are a natural
part of the fantasy ecology.
And then look at the sidebar in the section listing various types of swarms.
Monster Manual p377
The Nature of Swarms
The swarms presented here aren't ordinary or benign assemblies of
little creatures. They form as a result of some sinister or
A creature with the beast type is a natural creature. A swarm is something that does not occur naturally.
Of course, your DM may choose to allow you to choose a swarm. However, be wary of making such a choice. Each swarm, including the Swarm of Ravens has the following text:
The swarm can't regain hit points or gain temporary hit points.
Not being able to heal your swarm is likely going to cause you issues, especially given the relative squishiness of the animal companion in general.