de.tudarmstadt.ukp.jwktl.parser.en.components
Class ENTranslationHandler

java.lang.Object
  extended by de.tudarmstadt.ukp.jwktl.parser.components.BlockHandler
      extended by de.tudarmstadt.ukp.jwktl.parser.en.components.ENBlockHandler
          extended by de.tudarmstadt.ukp.jwktl.parser.en.components.ENSenseIndexedBlockHandler
              extended by de.tudarmstadt.ukp.jwktl.parser.en.components.ENTranslationHandler
All Implemented Interfaces:
IBlockHandler

public class ENTranslationHandler
extends ENSenseIndexedBlockHandler

Parser component for extracting translations from the English Wiktionary.

Author:
Christian M. Meyer, Lizhen Qu

Field Summary
protected static Pattern ADDITIONAL_TRANSLATION_PATTERN
           
protected  String currentSense
           
protected static Pattern NEXT_TRANSLATION_PATTERN
           
protected  Map<String,List<IWiktionaryTranslation>> sensNum2trans
           
protected static Pattern TRANSLATION_PATTERN
           
 
Fields inherited from class de.tudarmstadt.ukp.jwktl.parser.components.BlockHandler
labels
 
Constructor Summary
ENTranslationHandler()
          Initializes the block handler for parsing all sections starting with one of the specified labels.
 
Method Summary
protected  String cleanText(String text)
           
 void fillContent(ParsingContext context)
          Add parsed translation into senseEntry.
 boolean processBody(String text, 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.
protected  String[] reorderTemplateParams(String[] fields, Map<String,String> namedParams)
           
 
Methods inherited from class de.tudarmstadt.ukp.jwktl.parser.en.components.ENSenseIndexedBlockHandler
findMatchingSense
 
Methods inherited from class de.tudarmstadt.ukp.jwktl.parser.components.BlockHandler
canHandle, getLabels
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TRANSLATION_PATTERN

protected static final Pattern TRANSLATION_PATTERN

ADDITIONAL_TRANSLATION_PATTERN

protected static final Pattern ADDITIONAL_TRANSLATION_PATTERN

NEXT_TRANSLATION_PATTERN

protected static final Pattern NEXT_TRANSLATION_PATTERN

currentSense

protected String currentSense

sensNum2trans

protected Map<String,List<IWiktionaryTranslation>> sensNum2trans
Constructor Detail

ENTranslationHandler

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

Method Detail

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
Overrides:
processHead in class BlockHandler

processBody

public boolean processBody(String text,
                           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
Overrides:
processBody in class BlockHandler

reorderTemplateParams

protected String[] reorderTemplateParams(String[] fields,
                                         Map<String,String> namedParams)

cleanText

protected String cleanText(String text)

fillContent

public void fillContent(ParsingContext context)
Add parsed translation into senseEntry. If no mapping is found, the translation is added to posEntry.

Specified by:
fillContent in interface IBlockHandler
Overrides:
fillContent in class BlockHandler


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