Classroom humor is an important instructional strategy that enhances teaching effectiveness and improves student engagement. However, its automatic detection remains challenging due to the strong contextual dependency and implicit semantic shifts that characterize humorous expressions in teaching discourse. Conventional pretrained language models capture global semantics but often fail to focus on the subtle humor anchors that trigger incongruity. To address this issue, we propose T-HumorAGSA, a cognitive-inspired classroom teacher humor language detection model. The model employs BERT for contextualized semantic encoding, followed by a Gated Anchor-Guided Self-Attention (AGSA) mechanism that adaptively amplifies anchor-related features responsible for humor generation. A bidirectional gated recurrent unit (BiGRU) layer is further integrated to model long-range temporal dependencies within teaching utterances. T-HumorAGSA is evaluated on five datasets, including SemEval 2021 Task 7-1a, ColBERT, CCL2018, CCL2019 and the self-constructed teacher humor language dataset (T-Humor), demonstrating consistently strong performance. For instance, it achieves 0.9874 F1 on ColBERT and 0.9508 F1 on SemEval 2021 Task 7-1a, both outperforming the best baseline models. On the T-Humor dataset, the model attains a high F1 score of 0.9895, validating its capacity to detect subtle humorous cues in instructional discourse. The results demonstrate that the proposed model delivers excellent performance in classroom humor detection.
Cao et al. (Thu,) studied this question.