That said, there are examples where they key is ambiguous even to humans (e.g. Hey Joe [C G D A E], or Sweet Home Alabama [D C G] but disputed whether it’s in G or in D).
https://www.youtube.com/watch?v=DVvmALPu5TU
I had an unanswered question after the video -- are there listeners who don't feel that sense of "home" when arriving at the E chord? I certainly do feel "at home" on the E, but I'd be curious to hear others' opinions.
You can see from the graph that chords exist in multiple keys and you can move from one key to another via these shared chords known as 'pivot chords'
Whilst I'm no expert, I'm pretty sure we have hundreds of years of examples of borrowed chords [1] for music theorists to agree upon, so yes plenty of things a computer could do better (as per other comments).
The point is: a computer is good to analyse something following a fixed set of rules, but not so good to analyse something that work by "breaking rules", like art. It's quite "easy" to write some program for classical music, or blues, or rock, or any specific music style... but it will hardly work for a different music style because the progression and interpretation of chords will be different
This obviously has a number flaws, but worked remarkably well for western music written between 1600 and 1900.
For example, the A major scale goes A, B, C#, ..., while A minor uses the minor third, so you get A, B, C, ... etc.