本文整理汇总了Java中de.tudarmstadt.ukp.wikipedia.parser.Table类的典型用法代码示例。如果您正苦于以下问题:Java Table类的具体用法?Java Table怎么用?Java Table使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Table类属于de.tudarmstadt.ukp.wikipedia.parser包,在下文中一共展示了Table类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: checkRange
import de.tudarmstadt.ukp.wikipedia.parser.Table; //导入依赖的package包/类
private static void checkRange( SectionContent s ){
List<SrcSpan> eil = new ArrayList<SrcSpan>();
if( s.getTitleElement()!= null ){
checkRange( s.getTitleElement() );
eil.add( s.getTitleElement().getSrcSpan() );
}
for( Paragraph p: s.getParagraphs() ){
checkRange( p );
eil.add( p.getSrcSpan() );
}
for( DefinitionList dl: s.getDefinitionLists() ){
checkRange( dl );
eil.add( dl.getSrcSpan() );
}
for( NestedListContainer nl: s.getNestedLists() ){
checkRange( nl );
eil.add( nl.getSrcSpan() );
}
for( Table t: s.getTables() ){
checkRange( t );
eil.add( t.getSrcSpan() );
}
s.setSrcSpan( getEvalInfo( s.getSrcSpan(), eil));
}
示例2: eliminateEmptyStructures
import de.tudarmstadt.ukp.wikipedia.parser.Table; //导入依赖的package包/类
/**
* Removes all empty Structures from a SectionContent and all substructures.
*/
public static SectionContent eliminateEmptyStructures( SectionContent sc ){
for( int i=sc.nrOfParagraphs()-1; i>=0; i-- ){
Paragraph p = sc.getParagraph(i);
if( p.empty() ) sc.removeParagraph( p );
}
for( int i=sc.nrOfDefinitionLists()-1; i>=0; i--){
DefinitionList dl = sc.getDefinitionList(i);
eliminateEmptyStructures( dl );
if( dl.empty() ) sc.removeDefinitionList( dl );
}
for( int i=sc.nrOfNestedLists()-1; i>=0; i--){
NestedListContainer nl = sc.getNestedList(i);
eliminateEmptyStructures( nl );
if( nl.empty() ) sc.removeNestedList( nl );
}
for( int i=sc.nrOfTables()-1; i>=0; i--){
Table t = sc.getTable(i);
eliminateEmptyStructures( t );
if( t.empty() ) sc.removeTable( t );
}
return sc;
}
示例3: sectionCCLToHtml
import de.tudarmstadt.ukp.wikipedia.parser.Table; //导入依赖的package包/类
private static String sectionCCLToHtml( Section s ){
StringBuilder result = new StringBuilder();
if( s.getClass() == SectionContainer.class ){
for( Section ss: ((SectionContainer)s).getSubSections() ) {
result.append( sectionToHtml( ss ));
}
}
else{
List<Content> ccl = s.getContentList();
for( int i=(s.getTitleElement()!=null?1:0); i<ccl.size(); i++ ){
Content c = ccl.get(i);
Class cc = c.getClass();
if( cc == Paragraph.class ) {
result.append( paragraphToHtml( (Paragraph)c ) );
}
else if( cc == DefinitionList.class ) {
result.append( definitionListToHtml( (DefinitionList)c ) );
}
else if( cc == NestedListContainer.class ) {
result.append( nestedListToHtml( (NestedList)c ) );
}
else if( cc == Table.class ) {
result.append( tableToHtml( (Table)c ) );
}
else {
result.append("\n<pre>UNKNOWN CLASS: "+cc+"\n"+ convertTags( c.toString() )+"</pre>\n");
}
}
}
return result.toString();
}
示例4: tableToHtml
import de.tudarmstadt.ukp.wikipedia.parser.Table; //导入依赖的package包/类
/**
* Generates HTML Output for a Table.
*/
private static String tableToHtml( Table t ){
if( t == null ) {
return "null";
}
StringBuilder result = new StringBuilder();
int colspan;
try{
colspan = t.getTableElement( t.nrOfTableElements()-1 ).getCol()+1;
}catch( Exception e){
colspan = 1;
}
result.append("<table class=\"Table\">\n<tr><th colspan="+colspan+" class=\"Table\">Table");
if( t.getTitleElement()!=null ) {
result.append( contentElementToHtml( t.getTitleElement() ) );
}
result.append("</th></tr>\n<tr>\n");
int row = 0;
for( int i=0; i<t.nrOfTableElements(); i++ ){
TableElement td = t.getTableElement(i);
if( td.getRow() > row ){
result.append( "</tr><tr>\n");
row = td.getRow();
}
result.append( "<td class=\"Table\">\n" + tableElementToHtml( td ) +"</td>\n" );
}
result.append("</tr>\n</table>\n");
return result.toString();
}
示例5: checkRange
import de.tudarmstadt.ukp.wikipedia.parser.Table; //导入依赖的package包/类
private static void checkRange( SectionContent s ){
List<SrcSpan> eil = new ArrayList<SrcSpan>();
if( s.getTitleElement()!= null ){
checkRange( s.getTitleElement() );
eil.add( s.getTitleElement().getSrcSpan() );
}
for( Paragraph p: s.getParagraphs() ){
checkRange( p );
eil.add( p.getSrcSpan() );
}
for( DefinitionList dl: s.getDefinitionLists() ){
checkRange( dl );
eil.add( dl.getSrcSpan() );
}
for( NestedListContainer nl: s.getNestedLists() ){
checkRange( nl );
eil.add( nl.getSrcSpan() );
}
for( Table t: s.getTables() ){
checkRange( t );
eil.add( t.getSrcSpan() );
}
s.setSrcSpan( getEvalInfo( s.getSrcSpan(), eil));
}
示例6: handleSection
import de.tudarmstadt.ukp.wikipedia.parser.Table; //导入依赖的package包/类
private void handleSection( Section s, StringBuilder sb ){
EnumMap<SIT, EnumMap<CIT, Boolean>> hp = null;
if( s.getTitle()!= null ) hp = sectionHandling.get( SectionType.USER_SECTION.toString()+s.getTitle().toUpperCase() );
if( hp == null ) hp = sectionHandling.get(SectionType.SECTION_LEVEL.toString()+(s.getLevel()-levelModifier));
if( hp == null ) hp = sectionHandling.get(SectionType.DEFAULT_SECTION.toString());
if( hp == null ){
System.err.println( "Cannot get Handling Parameters for Section:\""+ s.getTitle()+"\" Level:"+s.getLevel() );
return;
}
handleContent( s.getTitleElement(), hp.get( SIT.TITLE ), sb );
if( s.getClass() == SectionContainer.class ){
if( hp.get( SIT.SUBS )!= null )
handleContent( s, hp.get( SIT.SUBS ), sb );
else
for( Section ss: ((SectionContainer)s).getSubSections() )
handleSection( ss, sb );
}
else{
EnumMap<CIT, Boolean> hpx;
hpx = hp.get( SIT.TABLE );
if( hpx != null )
for( Table t: s.getTables() )
handleContent( t, hpx, sb );
hpx = hp.get( SIT.NESTLIST );
if( hpx != null )
for( NestedList nl: s.getNestedLists() )
handleContent( nl, hpx, sb );
hpx = hp.get( SIT.PARA );
if( hpx != null )
for( Paragraph p: s.getParagraphs() )
handleContent( p, hpx, sb );
hpx = hp.get( SIT.DEFLIST );
if( hpx != null )
for( DefinitionList dl: s.getDefinitionLists() )
handleContent( dl, hpx, sb );
}
}
示例7: handleSection
import de.tudarmstadt.ukp.wikipedia.parser.Table; //导入依赖的package包/类
private void handleSection( Section s, StringBuilder sb ){
EnumMap<SIT, EnumMap<CIT, Boolean>> hp = null;
if( s.getTitle()!= null ) hp = sectionHandling.get( SectionType.USER_SECTION.toString()+s.getTitle().toUpperCase() );
if( hp == null ) hp = sectionHandling.get(SectionType.SECTION_LEVEL.toString()+(s.getLevel()-levelModifier));
if( hp == null ) hp = sectionHandling.get(SectionType.DEFAULT_SECTION.toString());
if( hp == null ){
System.err.println( "Cannot get Handling Parameters for Section:\""+ s.getTitle()+"\" Level:"+s.getLevel() );
return;
}
handleContent( s.getTitleElement(), hp.get( SIT.TITLE ), sb );
if( s.getClass() == SectionContainer.class ){
if( hp.get( SIT.SUBS )!= null )
handleContent( s, hp.get( SIT.SUBS ), sb );
else
for( Section ss: ((SectionContainer)s).getSubSections() )
handleSection( ss, sb );
}
else{
EnumMap<CIT, Boolean> hpx;
hpx = hp.get( SIT.TABLE );
if( hpx != null )
for( Table t: s.getTables() )
handleContent( t, hpx, sb );
hpx = hp.get( SIT.NESTLIST );
if( hpx != null )
for( NestedList nl: s.getNestedLists() )
handleContent( nl, hpx, sb );
hpx = hp.get( SIT.PARA );
if( hpx != null )
for( Paragraph p: s.getParagraphs() )
handleContent( p, hpx, sb );
hpx = hp.get( SIT.DEFLIST );
if( hpx != null )
for( DefinitionList dl: s.getDefinitionLists() )
handleContent( dl, hpx, sb );
}
}