de.tudarmstadt.ukp.jwktl.api.entry
Class WikiString

java.lang.Object
  extended by de.tudarmstadt.ukp.jwktl.api.entry.WikiString
All Implemented Interfaces:
IWikiString

@Persistent
public class WikiString
extends Object
implements IWikiString

Implementation of IWikiString that parses the original text (in wiki markup language) on demand instead of storing the parsed information in the database. Note that this used to be different prior to JWKTL 0.15.4.

Author:
Christian M. Meyer

Field Summary
protected static Pattern COMMENT_PATTERN
           
protected static Pattern HTML_PATTERN
           
protected static Pattern QUOTES_PATTERN
           
protected static Pattern REFERENCES_PATTERN
           
protected static Pattern TEMPLATE_PATTERN
           
protected  String text
           
protected static Pattern WHITESPACE_PATTERN
           
protected static Pattern WIKILINK_PATTERN
           
 
Constructor Summary
WikiString()
          Create a new, empty wiki string.
WikiString(String text)
          Create a new wiki string for the given wiki markup text.
 
Method Summary
 String getPlainText()
          Parses the original text to filter out all wiki markup and thus returns a human-readable version of the text.
 String getText()
          Returns the original text including all wiki markup.
 String getTextIncludingWikiMarkup()
           
 List<String> getWikiLinks()
          Returns a list of wiki-internal links.
static String makePlainText(String wikiText)
          Transforms the given wiki markup text into a plain text version.
 void setText(String text)
          Assign the given text as the new wiki markup text.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

text

protected String text

COMMENT_PATTERN

protected static final Pattern COMMENT_PATTERN

QUOTES_PATTERN

protected static final Pattern QUOTES_PATTERN

WIKILINK_PATTERN

protected static final Pattern WIKILINK_PATTERN

TEMPLATE_PATTERN

protected static final Pattern TEMPLATE_PATTERN

REFERENCES_PATTERN

protected static final Pattern REFERENCES_PATTERN

HTML_PATTERN

protected static final Pattern HTML_PATTERN

WHITESPACE_PATTERN

protected static final Pattern WHITESPACE_PATTERN
Constructor Detail

WikiString

public WikiString()
Create a new, empty wiki string.


WikiString

public WikiString(String text)
Create a new wiki string for the given wiki markup text.

Method Detail

getText

public String getText()
Description copied from interface: IWikiString
Returns the original text including all wiki markup.

Specified by:
getText in interface IWikiString

setText

public void setText(String text)
Assign the given text as the new wiki markup text.


getTextIncludingWikiMarkup

public String getTextIncludingWikiMarkup()
See Also:
getText().

getPlainText

public String getPlainText()
Description copied from interface: IWikiString
Parses the original text to filter out all wiki markup and thus returns a human-readable version of the text. Note that the parsing might be done on demand, so avoid invoking this method repeatedly for the same text.

Specified by:
getPlainText in interface IWikiString

getWikiLinks

public List<String> getWikiLinks()
Description copied from interface: IWikiString
Returns a list of wiki-internal links. That is, all substrings enclosed by two square brackets. Link captions will be removed. If no wiki links are found, an empty list will be returned. Note that the parsing might be done on demand, so avoid invoking this method repeatedly for the same text.

Specified by:
getWikiLinks in interface IWikiString

toString

public String toString()
Overrides:
toString in class Object

makePlainText

public static String makePlainText(String wikiText)
Transforms the given wiki markup text into a plain text version. That is, wiki links, templates, and typographic markers are being removed or substituted in order to obtain a human-readable text.



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