我想使用 R 计算不同发言者从文本中说出的行数(它是议会演讲记录的抄本)。基本文本如下所示:
MR. JOHN: This activity has been going on in Tororo and I took it up with the office of the DPC. He told me that he was not aware of it.
MS. SMITH: Yes, I am aware of that.
MR. LEHMAN: Therefore, I am seeking your guidance, Madam Speaker, and requesting that you re-assign the duty.
MR. JOHN: Thank you
在文档中,每个发言者都有一个以 MR/MS 开头且始终大写的标识符。我想创建一个数据集,该数据集计算文档中每次发言时每个发言者所说的行数,这样上述文本将导致:
MR. JOHN: 2
MS. SMITH: 1
MR. LEHMAN: 2
MR. JOHN: 1
感谢使用 R 的指针!