Skip to content

music21.text.assembleLyrics: support custom word separator#1797

Merged
mscuthbert merged 8 commits intocuthbertLab:masterfrom
oxygen-dioxide:custom-word-separator
Jun 23, 2025
Merged

music21.text.assembleLyrics: support custom word separator#1797
mscuthbert merged 8 commits intocuthbertLab:masterfrom
oxygen-dioxide:custom-word-separator

Conversation

@oxygen-dioxide
Copy link
Contributor

@oxygen-dioxide oxygen-dioxide commented Jun 21, 2025

This PR adds custom word separator support for music21.text.assembleLyrics.

Unlike European languages, in East Asian languages, words are not separated with space.

For example, This is a song's lyric extracted by music21:

也 许 很 远 或 是 昨 天 在 这 里 或 在 对 岸 长 路 辗 转 离 合 悲 欢 人 聚 又 人 散 放 过 对 错 才 知 答 案 活 着 的 勇 敢 没 有 神 的 光 环 你 我 生 而 平 凡

After this PR, I'll be able to extract the lyrics like this with assembleLyrics(stream, wordSeparator='')

也许很远或是昨天在这里或在对岸长路辗转离合悲欢人聚又人散放过对错才知答案活着的勇敢没有神的光环你我生而平凡

#1787 will be fixed.

@coveralls
Copy link

coveralls commented Jun 21, 2025

Coverage Status

coverage: 92.993% (+0.003%) from 92.99%
when pulling 3224b25 on oxygen-dioxide:custom-word-separator
into 3516adf on cuthbertLab:master.

@coveralls
Copy link

Coverage Status

coverage: 92.992% (+0.002%) from 92.99%
when pulling 7b8f4af on oxygen-dioxide:custom-word-separator
into 3516adf on cuthbertLab:master.

@oxygen-dioxide oxygen-dioxide marked this pull request as draft June 22, 2025 00:53
@oxygen-dioxide
Copy link
Contributor Author

Also I would like to add few Chinese folk music, such as Mo Li Hua into our corpus, for developers who want to test functionalities on East Asian languages. What do you think?

@oxygen-dioxide oxygen-dioxide marked this pull request as ready for review June 22, 2025 01:57
@mscuthbert
Copy link
Member

Thanks! I'm trying to make less-used additions keyword only and thought that all your tests had this. Will merge as soon as things pass.

@mscuthbert mscuthbert merged commit f2e09f1 into cuthbertLab:master Jun 23, 2025
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants