DKPro Core - NLTK intro examples ported to DKPro Core using Groovy
NLTK examples
In this section, we pick up some of the examples and implement them using DKPro Core.
Tokenize and tag some text
Original NLTK example:
DKPro Core Groovy version:
Output:
Identify named entities
Original NLTK example (must be run immediately after the previous example):
DKPro Core Groovy version:
Output:
Comparison NLTK vs. DKPro Core
We notice that the NLTK examples are much shorter, even though they include the output of the commands. The NTLK examples are run in an interactive Python shell where we just have to hack in a couple of commands. The DKPro Core examples are comparatively longish scripts - nothing that one would want to hack into a shell to play around with and explore NLP tools.
With a single import nltk we get access to a lot of functionality in NLTK, e.g. a default tokenizer, tagger, named entity recognizer, etc. However, all of these are for English only. In DKPro Core we need to first add dependencies on all the modules using @Graband then import the actual tools from the modules. We also need to add several unrelated imports to get access to necessary functions like selector createEngineDescription.
In NLTK we only have convenient access to a few tools for English. The script does not know what version of NLTK it is supposed to run with. With DKPro Core, we have access to a wide array of integrated tools and we know exactly which version of each tool we use. Also most of the tools do not only support English, but also additional languages.
In NLTK we can nicely execute one analysis step after the other and always explore the intermediate results. The DKPro Core scripts are more suitable for the batch-processing of larger amounts of documents.
Please support DKPro Core project by allowing this site to use cookies to track your activity. Doing so allows us to get an idea of how interesting our project is to the community. The EU General Data Protection Regulation (GDPR) requires us to ask you for your consent about the use of cookies. To learn more about how our site makes use of cookies and uses your activity data, please refer to our privacy policy. You can also always revise the choice you make here by visiting out privacy policy page.
Do you allow tracking your activity on this site using cookies?