Text Validation in NLP Applications: A Chain of Responsibility Approach
摘要
This paper introduces an approach for enhancing the existing web application for quantitative text analysis, QuanTA, by developing a validation module. The main idea was to improve the quality of text analysis by validating and correcting input text through checks for profanity, grammar errors, and spelling errors. As a proof of concept, the validation module was developed using the Chain of Responsibility design pattern, enabling flexibility and scalability by allowing the seamless addition of new validation rules without modifying the system's existing structure. The validation process utilizes key Python libraries, including Better-profanity, Pyspellchecker, and Gramformer. In addition, OpenAI's API was integrated to enable text correction. The results related to the development are reflected in a validation module that identifies and corrects detected errors, thus preparing the text for further analysis. A graphical user interface was developed to demonstrate the module’s functionalities and ease of use. The obtained conclusions emphasize the importance of applying design patterns to create adaptable and maintainable systems for text validation. The main value of this paper is reflected in the practical application of the Chain of Responsibility pattern for text validation, providing a foundation for future system enhancements.