斯坦福 NLP:法语选区解析器

Stanford NLP : Constituency parser in French

我想在我的 Python 程序中使用 Stanford NLP constituency 解析器。
我的服务器运行良好。


我想要的
我想获得在网络浏览器中使用服务器时的结果:


我的代码
这是我的代码:

from stanfordnlp.server import CoreNLPClient
from nltk.tree import Tree
with CoreNLPClient(annotators=[ 'tokenize','ssplit','pos','parse'],
                   timeout=30000,
                   output_format="json",
                   properties={'tokenize.language' :'fr',
                               'pos.model' : 'edu/stanford/nlp/models/pos-tagger/french/french.tagger',
                               'parse.model' : 'edu/stanford/nlp/models/lexparser/frenchFactored.ser.gz'}) as client :
    ann = client.annotate(text)

output = ann['sentences'][0]['parse']
parsetree = Tree.fromstring(output)
parsetree.pretty_print()

我目前的成绩
我目前的结果是这样的:

                         ROOT                 
                          |                    
                         SENT                 
    ______________________|________________    
   |           NP                          |  
   |      _____|__________                 |   
   |     |     |          PP               |  
   |     |     |      ____|____            |   
   VN    |     |     |         NP          |  
   |     |     |     |     ____|_______    |   
   V    DET    NC    P   ADV   P  DET  NC PUNC
   |     |     |     |    |    |   |   |   |   
Cherche les enfants  de moins  de  3  ans  .  

可以看出结构不一样...
你知道为什么我的结果不同吗?

我终于找到了解决方案:

以下是定义法语管道的基本代码:

https://github.com/stanfordnlp/CoreNLP/blob/master/src/edu/stanford/nlp/pipeline/StanfordCoreNLP-french.properties

因此,为了获得相同的结果而使用的解析模型是:

parse.model = edu/stanford/nlp/models/lexparser/frenchFactored.ser.gz