为什么FLAIR不能识别单句的完整地名?
Why FLAIR does't recognize the entire location name of simple sentence?
我想用 NER 算法检测简单的位置,我得到的结果是半正确的:
from flair.data import Sentence
from flair.models import SequenceTagger
tagger = SequenceTagger.load('ner')
text = 'Jackson leaves at north Carolina'
sentence = Sentence(text)
tagger.predict(sentence)
for entity in sentence.get_spans('ner'):
print(entity)
输出:
Span [1]: "Jackson" [− Labels: PER (0.9996)]
Span [5]: "Carolina" [− Labels: LOC (0.7363)]
我期待收到 "north Carolina"
。
- FLAIR 可以检测完整的位置描述吗?我们需要什么?
- 是否有猫检测完整位置描述的 NER 算法?
FLAIR 可以检测到完整的位置描述。您的问题的原因是 'north' 没有大写。
如果你运行
from flair.data import Sentence
from flair.models import SequenceTagger
tagger = SequenceTagger.load('ner')
text = 'Jackson leaves at North Carolina'
sentence = Sentence(text)
tagger.predict(sentence)
for entity in sentence.get_spans('ner'):
print(entity)
你会得到
Span[0:1]: "Jackson" → PER (0.9997)
Span[3:5]: "North Carolina" → LOC (0.9246)
我想用 NER 算法检测简单的位置,我得到的结果是半正确的:
from flair.data import Sentence
from flair.models import SequenceTagger
tagger = SequenceTagger.load('ner')
text = 'Jackson leaves at north Carolina'
sentence = Sentence(text)
tagger.predict(sentence)
for entity in sentence.get_spans('ner'):
print(entity)
输出:
Span [1]: "Jackson" [− Labels: PER (0.9996)]
Span [5]: "Carolina" [− Labels: LOC (0.7363)]
我期待收到 "north Carolina"
。
- FLAIR 可以检测完整的位置描述吗?我们需要什么?
- 是否有猫检测完整位置描述的 NER 算法?
FLAIR 可以检测到完整的位置描述。您的问题的原因是 'north' 没有大写。
如果你运行
from flair.data import Sentence
from flair.models import SequenceTagger
tagger = SequenceTagger.load('ner')
text = 'Jackson leaves at North Carolina'
sentence = Sentence(text)
tagger.predict(sentence)
for entity in sentence.get_spans('ner'):
print(entity)
你会得到
Span[0:1]: "Jackson" → PER (0.9997)
Span[3:5]: "North Carolina" → LOC (0.9246)