gov.sandia.cognition.text.convert
Class DocumentSingleFieldConverter

java.lang.Object
  extended by gov.sandia.cognition.util.AbstractCloneableSerializable
      extended by gov.sandia.cognition.data.convert.AbstractDataConverter<InputType,OutputType>
          extended by gov.sandia.cognition.text.convert.AbstractSingleTextualConverter<Document,Field>
              extended by gov.sandia.cognition.text.convert.DocumentSingleFieldConverter
All Implemented Interfaces:
DataConverter<Document,Field>, Evaluator<Document,Field>, SingleTextualConverter<Document,Field>, TextualConverter<Document,Field>, CloneableSerializable, Serializable, Cloneable

public class DocumentSingleFieldConverter
extends AbstractSingleTextualConverter<Document,Field>

Extracts a single field from a document. Typically used between the document extraction stage and tokenization stage to choose what text field to use in the text analysis.

Since:
3.1
Author:
Justin Basilico
See Also:
Serialized Form

Field Summary
protected  String fieldName
          The name of the field to extract.
 
Constructor Summary
DocumentSingleFieldConverter()
          Creates a new DocumentSingleFieldConverter with the body field as the field to extract.
DocumentSingleFieldConverter(String fieldName)
          Creates a new DocumentSingleFieldConverter with the given field to extract.
 
Method Summary
 Field evaluate(Document input)
          Evaluates the function on the given input and returns the output.
 String getFieldName()
          Gets the name of the field to extract.
 void setFieldName(String fieldName)
          Sets the name of the field to extract.
 
Methods inherited from class gov.sandia.cognition.text.convert.AbstractSingleTextualConverter
convert, convertAll
 
Methods inherited from class gov.sandia.cognition.util.AbstractCloneableSerializable
clone
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

fieldName

protected String fieldName
The name of the field to extract.

Constructor Detail

DocumentSingleFieldConverter

public DocumentSingleFieldConverter()
Creates a new DocumentSingleFieldConverter with the body field as the field to extract.


DocumentSingleFieldConverter

public DocumentSingleFieldConverter(String fieldName)
Creates a new DocumentSingleFieldConverter with the given field to extract.

Parameters:
fieldName - The name of the field to extract.
Method Detail

evaluate

public Field evaluate(Document input)
Description copied from interface: Evaluator
Evaluates the function on the given input and returns the output.

Parameters:
input - The input to evaluate.
Returns:
The output produced by evaluating the input.

getFieldName

public String getFieldName()
Gets the name of the field to extract.

Returns:
The name of the field to extract.

setFieldName

public void setFieldName(String fieldName)
Sets the name of the field to extract.

Parameters:
fieldName - The name of the field to extract.