public class WikipediaJwpl
extends Wikipedia
Constructor and Description |
---|
WikipediaJwpl(DatabaseConfiguration dbConfig)
Invokes the super class with the database configuration, sets the
constants loads the JWPL Wikipedia instance.
|
WikipediaJwpl(java.util.Locale lang,
int year)
Creates its own database configuration according to language and year
|
Modifier and Type | Method and Description |
---|---|
java.lang.String[] |
getCategoryLabels() |
java.lang.String[] |
getImageLabels() |
static java.lang.String |
getJwplDBprefix() |
java.util.List<Paragraph> |
getParagraphsFromArticle(int id)
Obtains the paragraphs of a parsed article id
|
java.util.List<Paragraph> |
getParagraphsFromArticle(java.lang.String title)
Obtains the paragraphs of a parsed article title
|
ParsedPage |
getParsedArticle(int id)
Parses a Wikipedia article
|
ParsedPage |
getParsedArticle(java.lang.String title)
Parses a Wikipedia article
|
MediaWikiParser |
getParser()
TODO determine whether this parser should be returned.
|
java.util.List<Section> |
getSectionsFromArticle(int id)
Obtains the sections of parsed article
|
java.util.List<Section> |
getSectionsFromArticle(java.lang.String title)
Obtains the sections of a parsed article
|
void |
getSubSectionsFromArticle(int id)
Obtains the sub-sections of a parsed article
|
void |
getSubSectionsFromArticle(java.lang.String title)
Obtains the sub-sections of a parsed article
|
boolean |
isAcronym(Page page)
Checks if the page is an acronym page
|
boolean |
isDisambiguation(Page page)
Checks if this is a disambiguation page
|
boolean |
isRedirect(Page page)
Checks if the page is a redirect page
|
void |
loadWikipedia()
Sets the image and category labels for the working language.
|
static void |
main(java.lang.String[] args)
In this example we run an instance of Wikipedia and display a couple of
articles' contents.
|
public WikipediaJwpl(java.util.Locale lang, int year) throws WikiApiException
lang
- year
- can be only "2010", "2012", or "2013"WikiApiException
public WikipediaJwpl(DatabaseConfiguration dbConfig) throws WikiApiException
dbConfig
- WikiApiException
public void loadWikipedia() throws WikiApiException
WikiApiException
public boolean isAcronym(Page page) throws WikiTitleParsingException
page
- The page to checktrue
if the given page is an acronym page;
false
otherwise.WikiTitleParsingException
public boolean isRedirect(Page page)
page
- The page to checktrue
if the given page is a redirect page;
false
otherwise.public static java.lang.String getJwplDBprefix()
public java.lang.String[] getImageLabels()
public java.lang.String[] getCategoryLabels()
public MediaWikiParser getParser()
public ParsedPage getParsedArticle(int id) throws WikiApiException
id
- id for the article to be parsedWikiApiException
MediaWikiParser}
public ParsedPage getParsedArticle(java.lang.String title) throws WikiApiException
title
- Title for the Wikipedia articleWikiApiException
MediaWikiParser}
public java.util.List<Section> getSectionsFromArticle(int id) throws WikiApiException
id
- for the articleWikiApiException
public java.util.List<Section> getSectionsFromArticle(java.lang.String title) throws WikiApiException
title
- of the articleWikiApiException
public void getSubSectionsFromArticle(int id) throws WikiApiException
id
- of the articleWikiApiException
public void getSubSectionsFromArticle(java.lang.String title) throws WikiApiException
title
- of the articleWikiApiException
- TODO: right now this doesn't get anythingpublic java.util.List<Paragraph> getParagraphsFromArticle(int id) throws WikiApiException
id
- WikiApiException
public java.util.List<Paragraph> getParagraphsFromArticle(java.lang.String title) throws WikiApiException
title
- WikiApiException
public boolean isDisambiguation(Page page) throws WikiTitleParsingException
page
- The page to checktrue
if the given page is a disambiguation page;
false
otherwise.WikiTitleParsingException
public static void main(java.lang.String[] args) throws WikiApiException
args
- WikiApiException