🚀 名词化检测器
本模型用于识别“谓词性名词化”,即在上下文中具有事件性(或“动词性”)含义的名词化形式。它基于bert-base-cased
预训练模型,针对QANom项目(Klein等人,COLING 2020)所定义和标注的“名词化检测”任务进行了标记分类的微调。
🚀 快速开始
本模型作为二元分类器进行训练,用于对候选名词化形式进行分类。候选词通过词性标注器(筛选普通名词)以及词汇资源(如WordNet和CatVar)提取,筛选出具有(至少一个)派生相关动词的名词。在QANom标注项目中,这些候选词会交给标注人员,以确定它们在句子上下文中是否具有“动词性”含义。当前模型可重现这种二元分类。
✨ 主要特性
- 基于
bert-base-cased
预训练模型,针对名词化检测任务进行微调。
- 能够识别句子中具有事件性含义的名词化形式。
📦 安装指南
候选词提取算法在qanom
包中实现。你可以通过以下命令安装qanom
包:
pip install qanom
💻 使用示例
基础用法
from qanom.nominalization_detector import NominalizationDetector
detector = NominalizationDetector()
raw_sentences = ["The construction of the officer 's building finished right after the beginning of the destruction of the previous construction ."]
print(detector(raw_sentences, return_all_candidates=True))
print(detector(raw_sentences, threshold=0.75, return_probability=False))
输出示例
[[{'predicate_idx': 1,
'predicate': 'construction',
'predicate_detector_prediction': True,
'predicate_detector_probability': 0.7626778483390808,
'verb_form': 'construct'},
{'predicate_idx': 4,
'predicate': 'officer',
'predicate_detector_prediction': False,
'predicate_detector_probability': 0.19832570850849152,
'verb_form': 'officer'},
{'predicate_idx': 6,
'predicate': 'building',
'predicate_detector_prediction': True,
'predicate_detector_probability': 0.5794129371643066,
'verb_form': 'build'},
{'predicate_idx': 11,
'predicate': 'beginning',
'predicate_detector_prediction': True,
'predicate_detector_probability': 0.8937646150588989,
'verb_form': 'begin'},
{'predicate_idx': 14,
'predicate': 'destruction',
'predicate_detector_prediction': True,
'predicate_detector_probability': 0.8501205444335938,
'verb_form': 'destruct'},
{'predicate_idx': 18,
'predicate': 'construction',
'predicate_detector_prediction': True,
'predicate_detector_probability': 0.7022264003753662,
'verb_form': 'construct'}]]
[[{'predicate_idx': 1, 'predicate': 'construction', 'verb_form': 'construct'},
{'predicate_idx': 11, 'predicate': 'beginning', 'verb_form': 'begin'},
{'predicate_idx': 14, 'predicate': 'destruction', 'verb_form': 'destruct'}]]
📚 详细文档
📄 许可证
文档中未提及许可证相关信息。
📚 引用
如果你使用了本模型,请引用以下文献:
@inproceedings{klein2020qanom,
title={QANom: Question-Answer driven SRL for Nominalizations},
author={Klein, Ayal and Mamou, Jonathan and Pyatkin, Valentina and Stepanov, Daniela and He, Hangfeng and Roth, Dan and Zettlemoyer, Luke and Dagan, Ido},
booktitle={Proceedings of the 28th International Conference on Computational Linguistics},
pages={3069--3083},
year={2020}
}