Application of AI in the legal sector: challenges and opportunities