ltp的使用
ltp 可以分词 词性识别 命名实体识别,使用过程:
import pyltp
from pyltp import SentenceSplitter
from pyltp import Segmentor
from pyltp import Postagger
from pyltp import NamedEntityRecognizer
segmentor = Segmentor()
segmentor.load('ltp_model/cws.model') # 加载分词模型
words = segmentor.segment(address)#分词
postagger = Postagger()
postagger.load('ltp_model/pos.model') # 加载词性分析模型
recognizer = NamedEntityRecognizer()
recognizer.load('ltp_model/ner.model') # 加载命名实体识别模型
words = segmentor.segment(address)#分词
posttags = postagger.postag(words) # 词性标注
recognizers=recognizer.recogniz(posttags)#命名实体识别