de.tudarmstadt.ukp.jwktl.parser.components
Class BlockHandler

java.lang.Object
  extended by de.tudarmstadt.ukp.jwktl.parser.components.BlockHandler
All Implemented Interfaces:
IBlockHandler
Direct Known Subclasses:
CategoryHandler, DEBlockHandler, ENBlockHandler, InterwikiLinkHandler

public abstract class BlockHandler
extends Object
implements IBlockHandler

Default implementation of the IBlockHandler interface that serves as a base class for parsing any article constituent.


Field Summary
protected  String[] labels
           
 
Constructor Summary
BlockHandler(String... labels)
          Initializes the block handler for parsing all sections starting with one of the specified labels.
 
Method Summary
 boolean canHandle(String blockHeader)
          Return true if the handler requests to process the article constituent starting at the given line of text.
 void fillContent(ParsingContext context)
          This hotspot is invoked if the parser releases this handler.
protected  String[] getLabels()
           
 boolean processBody(String textLine, ParsingContext context)
          If the handler requested to process the body of this constituent, this hotspot will be called for processing each line of the constituent's body.
 boolean processHead(String text, ParsingContext context)
          If the handler requested to process this constituent, this hotspot will be called for processing the section header of this article constituent.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

labels

protected String[] labels
Constructor Detail

BlockHandler

public BlockHandler(String... labels)
Initializes the block handler for parsing all sections starting with one of the specified labels.

Method Detail

canHandle

public boolean canHandle(String blockHeader)
Description copied from interface: IBlockHandler
Return true if the handler requests to process the article constituent starting at the given line of text.

Specified by:
canHandle in interface IBlockHandler

processHead

public boolean processHead(String text,
                           ParsingContext context)
Description copied from interface: IBlockHandler
If the handler requested to process this constituent, this hotspot will be called for processing the section header of this article constituent. Return true if the handler requests to handle also the body of this constituent.

Specified by:
processHead in interface IBlockHandler

processBody

public boolean processBody(String textLine,
                           ParsingContext context)
Description copied from interface: IBlockHandler
If the handler requested to process the body of this constituent, this hotspot will be called for processing each line of the constituent's body. Return true if the handler requests to handle also the next line using this handler.

Specified by:
processBody in interface IBlockHandler

fillContent

public void fillContent(ParsingContext context)
Description copied from interface: IBlockHandler
This hotspot is invoked if the parser releases this handler. It can be used to store the extracted information to the Wiktionary data objects stored in the parsing context.

Specified by:
fillContent in interface IBlockHandler

getLabels

protected String[] getLabels()


Copyright © 2011-2013 Ubiquitous Knowledge Processing (UKP) Lab. All Rights Reserved.