The application provides an off-topic detection method and
system for compositions. The method extracts key features of questions from
topic sentence encoding by a neural
network model, and extracts key features of answers from composition encoding. The key features of
questions and answers are input into an attention mechanism layer, ensuring that the features input into the attention mechanism layer are key features, reducing interference caused by other useless features when the attention mechanism layer processes data, and improving the accuracy of
data processing by the attention mechanism layer. On this basis, the attention mechanism layer determines the features of the
topic sentence that the composition is concerned about, and the features of the composition that the
topic sentence is concerned about, completing
feature selection from two directions, ensuring the comprehensiveness of the selected features, enabling the neural
network model to classify based on more comprehensive features, improving the accuracy of the
classification result, and thereby improving the accuracy of the detection.