Stanford Parser and NLTK

后端 未结 18 2363
既然无缘
既然无缘 2020-11-22 01:32

Is it possible to use Stanford Parser in NLTK? (I am not talking about Stanford POS.)

18条回答
  •  北荒
    北荒 (楼主)
    2020-11-22 02:27

    Note that this answer applies to NLTK v 3.0, and not to more recent versions.

    Since nobody really mentioned and it's somehow troubled me a lot, here is an alternative way to use Stanford parser in python:

    stanford_parser_jar = '../lib/stanford-parser-full-2015-04-20/stanford-parser.jar'
    stanford_model_jar = '../lib/stanford-parser-full-2015-04-20/stanford-parser-3.5.2-models.jar'    
    parser = StanfordParser(path_to_jar=stanford_parser_jar, 
                            path_to_models_jar=stanford_model_jar)
    

    in this way, you don't need to worry about the path thing anymore.

    For those who cannot use it properly on Ubuntu or run the code in Eclipse.

提交回复
热议问题