How AI and databases are helping lawyers and companies predict how judges will rule