O'Reilly logo

Natural Language Processing with Java and LingPipe Cookbook by Krishna Dayanidhi, Breck Baldwin

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

NER using CRFs with better features

In this recipe, we'll show you how to create a realistic, though not quite state-of-the-art, set of features for CRFs. The features will include normalized tokens, part-of-speech tags, word-shape features, position features, and token prefixes and suffixes. Substitute it for the SimpleCrfFeatureExtractor in the CRFs for chunking recipe to use it.

How to do it…

The source for this recipe is in src/com/lingpipe/cookbook/chapter5/FancyCrfFeatureExtractor.java:

  1. Open up your IDE or command prompt and type:
    java -cp lingpipe-cookbook.1.0.jar:lib/lingpipe-4.1.0.jar: com.lingpipe.cookbook.chapter5.FancyCrfFeatureExtractor
    
  2. Brace yourself for an explosion of features from the console. The data being used for feature extraction ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required