edu.upenn.cis.taggers.frontend
Class Article

java.lang.Object
  extended by edu.upenn.cis.taggers.frontend.Article

public class Article
extends java.lang.Object

An article is a collection of field names and values, in the order they were received. Methods exist to tag fields and output in MEDLINE and HTML formats.


Field Summary
static boolean HTML
           
static boolean MEDLINE
           
 
Constructor Summary
Article(Tagger t)
           
 
Method Summary
 void add(java.lang.String f, java.lang.String v)
          Add a field-value pair.
 java.lang.String getValue(java.lang.String f)
          Return the value associated with a field, or null if there isn't one If it's been tagged or modified in any way, gets the modified one.
 void tag(java.lang.String f)
          Tag the value associated with that field.
 java.lang.String toString(boolean b)
          Returns this article in either MEDLINE or HTML format MEDLINE will use all the original strings, with additional tags (specified by the tagger) for the data.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MEDLINE

public static final boolean MEDLINE
See Also:
Constant Field Values

HTML

public static final boolean HTML
See Also:
Constant Field Values
Constructor Detail

Article

public Article(Tagger t)
Method Detail

add

public void add(java.lang.String f,
                java.lang.String v)
Add a field-value pair. Duplicates allowed.

Parameters:
f - The field
v - The value

tag

public void tag(java.lang.String f)
         throws java.io.IOException
Tag the value associated with that field. Uses find() to get the value, so it only tags the first entry for that field if multiple exist. This is fine, so long as articles only have one title field and one abstract field. The old string will be retained for output to MEDLINE files.

Parameters:
f - The field whose value will be tagged
Throws:
java.io.IOException

toString

public java.lang.String toString(boolean b)
Returns this article in either MEDLINE or HTML format MEDLINE will use all the original strings, with additional tags (specified by the tagger) for the data. HTML will use XML and additional tags (usually font colors, as specified by the individual tagger) to show the tagger's work. Some formatting information is drawn from the tagger object.

Parameters:
b - Article.MEDLINE or Article.HTML depending which output you want
Returns:
This article, as either a MEDLINE entry or HTML

getValue

public java.lang.String getValue(java.lang.String f)
Return the value associated with a field, or null if there isn't one If it's been tagged or modified in any way, gets the modified one.

Parameters:
f - The field whose value will be retrieved
Returns:
The first value associated with that field