A judge has ruled that Anthropic's AI training on copyrighted material is fair use, but the company faces potential legal action over pirated books.