A Survey on LLM-generated Text Detection: Necessity, Methods, and Future Directions