【发布时间】:2016-01-29 16:45:21
【问题描述】:
我有一个 XML 文件,我希望提取未标记的文本。
<body>
<p>The prognosis of patients with rectal cancer has improved since the introduction of total mesorectal excision (TME) surgery [
<xref ref-type="bibr" rid="CR1">1</xref>–
<xref ref-type="bibr" rid="CR3">3</xref>]. Using this surgical technique the mesorectal compartment including the rectum and perirectal fat is completely excised by sharp dissection along the mesorectal fascia (MRF) [
<xref ref-type="bibr" rid="CR1">1</xref>]. Additionally, large randomized trials have shown that neo-adjuvant therapy improves local tumor control even further, regardless of optimized surgical techniques [
<xref ref-type="bibr" rid="CR3">3</xref>,
<xref ref-type="bibr" rid="CR4">4</xref>]. The advances in rectal cancer treatment have provoked differentiated neo-adjuvant treatment strategies based on anatomical preoperative identifiable risk factors for local tumor recurrence as can be visualized with magnetic resonance imaging (MRI) [
<xref ref-type="bibr" rid="CR5">5</xref>]. One of the most important risk factors is the tumor relationship to the MRF, which actually defines the surgical circumferential resection margin (CRM) in TME surgery [
<xref ref-type="bibr" rid="CR6">6</xref>,
<xref ref-type="bibr" rid="CR7">7</xref>]. Long courses of neo-adjuvant chemoradiation have emerged as the preferential treatment of patients with anticipated tumor invasion of the MRF on MRI in order to downstage/downsize the tumor and to obtain tumor free resection margins [
<xref ref-type="bibr" rid="CR5">5</xref>].
</p>
</body>
所以正文可能包含多个<p> 标签。我希望提取像
"]. 使用这种手术技术,直肠系膜室包括 直肠和直肠周围脂肪被锐器完全切除 沿直肠系膜筋膜 (MRF) 解剖 ["
,位于CR3 和CR1 之间,依此类推(即在连续的xref 之间)。我还需要将此文本添加到字典中,该字典将相应的rid 映射到rid 之后的此类文本列表。我如何使用 beautifulsoup 和/或 regexp 来做到这一点。
【问题讨论】:
-
你得到答案了吗?
标签: python regex xml beautifulsoup