如何在python中访问这些标记中的文本?

2024-09-28 22:21:53 发布

您现在位置:Python中文网/ 问答频道 /正文

我有一个数据集,在那里我标记了名词短语。如何找到这些标签并从标签中提取数据

در
همین
حال
<coref coref_coref_class="set_0" coref_mentiontype="ne" markable_scheme="coref" coref_coreftype="ident">
نجیب
الله
خواجه
عمری
</coref>
<coref coref_coref_class="set_0" coref_mentiontype="np" markable_scheme="coref" coref_coreftype="ident">
سرپرست
وزارت
تحصیلات
عالی
افغانستان
</coref>
گفت
که


 def ex_feature(text):
    for w in text:
        if w.startswith("<coref") and w.endswith("</coref>"):
            print(w)

Tags: 数据text标记np标签classschemene