NER概率的Spacy 3波束解析 [英] spaCy 3 beam parse for NER probability

查看:27
本文介绍了NER概率的Spacy 3波束解析的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在将正确的标签分配给实体时检索我的空间模型的概率。我的Spacy版本为3.0.5。

threshold = 0.5
        
for i in testing_raw:
    doc = nlp_updated(i)
    beams = nlp_updated.beam_parse([ doc ], beam_width = 16, beam_density = 0.0001)
    entity_scores = defaultdict(float)

    for beam in beams:
        for score, ents in nlp_updated.entity.moves.get_beam_parses(beam):
            for start, end, label in ents:
                entity_scores[(start, end, label)] += score

        for key in entity_scores:
            start, end, label = key
            score = entity_scores[key]
            if ( score > threshold):
                print ('Label: {}, Text: {}, Score: {}'.format(label, doc[start:end], score))

以下行抛出此错误:

beams = nlp_updated.beam_parse([ doc ], beam_width = 16, beam_density = 0.0001)

AttributeError: 'English' object has no attribute 'beam_parse'
这是因为Spacy版本3不考虑beam_parse吗?如果是,我如何在此版本的Spacy中执行此操作,因为我似乎在文档中找不到任何内容?

推荐答案

此获取NER概率的解决方法在v3中不起作用,因为API已更改,目前没有建议的替代方案。

正在开发一种SpanCategorizer,它将允许您获得具有置信度分数的NER标签。

这篇关于NER概率的Spacy 3波束解析的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆