Ooo... yeah.
The closest thing is ComputerCraft MiscPeripherals can read IDs.... but I don't think they can read Data Values. And I think they only can read inventory items (the Interactive Sorters). The
Minecraft Wiki seems to imply Librarians have a DV of 1.
Just put the villagers into a water trap, have a turtle/block detect their IDs, and activate a track switch to the right destination and load them in minecarts for sorting (with unloaders at their destination).
Could even have overflow detection to lava everything if the destination is full (pressure plate and wireless redstone.... if it's full they won't be able to move away).
See, farming villagers
CAN be fun.