python3.6和Stanford corenlp3.9.1下法语的句法分析和词性标注

2024-09-30 16:20:35 发布

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

有没有人有过修改以下(3.6)Python代码以获得法语而非英语词性标注的经验:

# *** POS tagging *** with CoreNLP
from nltk.tag.stanford import CoreNLPPOSTagger
CoreNLPPOSTagger(url='http://localhost:9000').tag('What is the airspeed of an unladen swallow ?'.split())

同样,对于解析:

# *** Parsing *** with CoreNLP
from nltk.parse.corenlp import CoreNLPParser
stanford_parser = CoreNLPParser()
json_result = stanford_parser.api_call('He is fine')
for sentence in json_result['sentences']:
    for token in sentence['tokens']:
        print(token) 

所有这些代码运行平稳。你知道吗

谢谢你的帮助。你知道吗

L


Tags: fromimportjsonparserforistagwith