Is there a ready-to-use English grammar that I can just load it and use in NLTK? I\'ve searched around examples of parsing with NLTK, but it seems like that I have to manual
I'm found out that nltk working good with parser grammar developed by Stanford.
Syntax Parsing with Stanford CoreNLP and NLTK
It is very easy to start to use Stanford CoreNLP and NLTK. All you need is small preparation, after that you can parse sentences with following code:
from nltk.parse.corenlp import CoreNLPParser
parser = CoreNLPParser()
parse = next(parser.raw_parse("I put the book in the box on the table."))
Preparation:
You can use following code to run CoreNLPServer:
import os
from nltk.parse.corenlp import CoreNLPServer
# The server needs to know the location of the following files:
# - stanford-corenlp-X.X.X.jar
# - stanford-corenlp-X.X.X-models.jar
STANFORD = os.path.join("models", "stanford-corenlp-full-2018-02-27")
# Create the server
server = CoreNLPServer(
os.path.join(STANFORD, "stanford-corenlp-3.9.1.jar"),
os.path.join(STANFORD, "stanford-corenlp-3.9.1-models.jar"),
)
# Start the server in the background
server.start()
Do not forget stop server with executing server.stop()