Clear Sky Science · en

Multi-dimensional text feature fusion-based BA-RILA for ancient Chinese poetry theme recognition

· Back to index

Why teaching computers to read ancient poems matters

Ancient Chinese poems hold centuries of emotion, history, and daily life, but their language is so different from modern Chinese that even experts debate their meaning. As more libraries and museums digitize these works, there is a growing need for smart tools that can quickly sort poems by topic, helping scholars, students, and the public explore huge collections. This study presents a new way for computers to recognize what an ancient poem is about, using not only word meaning but also rhythm and imagery to better capture the spirit of classical verse.

Turning classic poems into data

To teach a computer about poetry, the researchers first had to build the right kind of dataset. They collected about 10,000 poems from major Chinese dynasties, mainly Tang and Song, and carefully labeled each one into six broad themes such as friendship and farewell, history and nostalgia, landscapes and countryside, love and marriage, homesickness, and frontier and war. They removed noisy or incomplete texts, segmented the classical Chinese, and filtered out function words that do not carry much meaning. Word cloud analyses showed that each theme had its own characteristic vocabulary, confirming that the labels matched well with the poetic content.

Figure 1. How AI sorts large collections of ancient Chinese poems into themes using meaning, sound, and imagery.
Figure 1. How AI sorts large collections of ancient Chinese poems into themes using meaning, sound, and imagery.

Blending meaning, sound, and imagery

Most language technologies focus on word meaning alone, but classical Chinese poetry also relies heavily on sound patterns and symbolic images. The new BA-RILA model combines three kinds of information. First, it uses a version of the popular BERT language model that has been retrained on ancient Chinese, so that the computer can better understand old grammar and classic turns of phrase. Second, it measures rhythm using eleven numerical features that capture rhyme, line length, tone patterns, and couplet structures, reflecting how lines sound and balance. Third, it tracks poetic imagery through a 75-part description built from 25 culturally important symbols, such as willows for parting or the moon for longing, each with frequency, emotional tone, and strength within a poem.

How the model learns from whole poems

These three streams of information differ in scale, so the system first maps them into a common space and uses an internal attention mechanism to decide how much weight to give semantics, rhythm, and imagery for each poem. The fused features then pass through two layers of a bidirectional recurrent network that reads the poem both forwards and backwards, capturing how meaning unfolds over time. A multi-head attention module further highlights the most informative parts of this representation by looking at it from several angles at once. Finally, a set of fully connected layers turns this rich internal picture into a probability over the six themes, deciding which topic best matches the poem.

Figure 2. How an AI model blends meaning, rhythm, and poetic images step by step to decide a single poem’s theme.
Figure 2. How an AI model blends meaning, rhythm, and poetic images step by step to decide a single poem’s theme.

How well the system works

Extensive tests show that BA-RILA clearly outperforms several strong benchmark models that rely only on modern BERT, on convolutional networks, or on simpler recurrent designs. On the six-theme task, the new method reaches an accuracy of about 97 percent, with stable performance even on less common themes. When the authors removed individual parts of the system, such as the ancient-Chinese-tuned BERT, the rhythm and imagery fusion, the recurrent layers, or the attention module, performance dropped noticeably, indicating that each piece contributes meaningfully. The model also handled poems from both the Tang and Song periods, though it found Song poetry somewhat harder because its rhythms are less regular and its language more diffuse.

What this means for exploring classical literature

To a non-specialist, the key takeaway is that combining word meaning with sound and symbolic images allows computers to sort ancient poems by theme in a way that better reflects traditional reading practices. Rather than treating poetry as plain text, the BA-RILA approach respects its musicality and cultural imagery, leading to more reliable automatic labeling. Such tools could make it easier to search large archives, compare poets across dynasties, or study how themes like homesickness or war evolved over time, supporting both academic research and public appreciation of classical Chinese culture.

Citation: Zhang, X., Liu, Y. Multi-dimensional text feature fusion-based BA-RILA for ancient Chinese poetry theme recognition. Sci Rep 16, 16573 (2026). https://doi.org/10.1038/s41598-026-48986-2

Keywords: ancient Chinese poetry, theme classification, text feature fusion, poetry imagery, cultural NLP