congrats Icon
New! Tabnine Pro 14-day free trial
Start a free trial
Tabnine Logo
NestedListContainer
Code IndexAdd Tabnine to your IDE (free)

How to use
NestedListContainer
in
de.tudarmstadt.ukp.wikipedia.parser

Best Java code snippets using de.tudarmstadt.ukp.wikipedia.parser.NestedListContainer (Showing top 9 results out of 315)

origin: dkpro/dkpro-jwpl

private static void checkRange( NestedListContainer nlc ){
  for( NestedList nl: nlc.getNestedLists() ){
    if( nl.getClass() == NestedListContainer.class )
      checkRange( (NestedListContainer)nl );
    else
      checkRange( (ContentElement)nl );
  }
}
origin: dkpro/dkpro-jwpl

/**
 * Removes all empty Structures from a NestedListContainer and all substructures.
 */
public static NestedListContainer eliminateEmptyStructures( NestedListContainer nlc ){
  for(int i=nlc.size()-1; i>=0; i--){
    NestedList nl = nlc.getNestedList(i);
    if( nl.getClass()==NestedListContainer.class )
      eliminateEmptyStructures( (NestedListContainer)nl );
    
    if( nl.empty() )nlc.remove( nl );			
  }
  return nlc;
}

origin: dkpro/dkpro-jwpl

/**
 * Generates HTML Output for a {@link NestedList}.
 */
private static String nestedListToHtml( NestedList nl ){
  if( nl == null ) {
    return "null";
  }
  StringBuilder result = new StringBuilder();
  if( nl.getClass()==NestedListElement.class ){
    result.append( "<li>\n"+ contentElementToHtml( (NestedListElement)nl ) +"</li>\n" );
  }
  else{
    result.append("<table class=\"NestedList\">\n" +
        "<tr><th class=\"NestedList\">NestedList</th></tr>\n"+
        "<tr><td class=\"NestedList\">" );
    result.append((((NestedListContainer)nl).isNumbered()?"<ol>":"<ul>")+"\n" );
    for( NestedList nl2 : ((NestedListContainer)nl).getNestedLists() ) {
      result.append( nestedListToHtml( nl2 ) );
    }
    result.append((((NestedListContainer)nl).isNumbered()?"</ol>":"</ul>")+"\n");
    result.append("</td></tr>\n" );
    result.append("</table>\n");
  }
  return result.toString();
}
origin: dkpro/dkpro-jwpl

NestedListContainer result = new NestedListContainer(numbered);
  result.setSrcSpan(new SrcSpan(sm.getSrcPos(lineSpans.getFirst()
      .getStart()), -1));
  result.getSrcSpan().setEnd(
      sm.getSrcPos(nestedListSpans.getLast().getEnd()));
  if (t == lineType.NESTEDLIST || t == lineType.NESTEDLIST_NR)
    result.add(buildNestedList(sm, cepp, nestedListSpans, t));
    result.add((NestedListElement) parseContentElement(sm, cepp, s,
        new NestedListElement()));
origin: dkpro/dkpro-jwpl

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));
}

origin: dkpro/dkpro-jwpl

/**
 * 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;
}

origin: diegoceccarelli/json-wikipedia

private void setLists(Article article, ParsedPage page) {
  List<List<String>> lists = new ArrayList<List<String>>();
  for (DefinitionList dl : page.getDefinitionLists()) {
    List<String> l = new ArrayList<String>();
    for (ContentElement c : dl.getDefinitions()) {
      l.add(c.getText());
    }
    lists.add(l);
  }
  for (NestedListContainer dl : page.getNestedLists()) {
    List<String> l = new ArrayList<String>();
    for (NestedList nl : dl.getNestedLists()) {
      l.add(nl.getText());
    }
    lists.add(l);
  }
  article.setLists(lists);
}
origin: dkpro/dkpro-jwpl

result += "---";	// If it is not a NestedListElement, it is a NestedListContainer
for(NestedList nl2 : ((NestedListContainer)nl).getNestedLists()) {
  result += "\n"+outputNestedList(nl2, depth+1);
origin: diegoceccarelli/json-wikipedia

private void setLinksInLists(final List<Link> links, final List<Link> externalLinks,  ParsedPage page){
  int listId = 0;
  for (NestedListContainer p : page.getNestedLists()){
    int item = 0;
    for (NestedList list : p.getNestedLists()) {
      for (de.tudarmstadt.ukp.wikipedia.parser.Link link : list.getLinks()) {
        Link linkAdded = addLink(links, externalLinks, link, Link.Type.LIST);
        if (linkAdded != null) {
          linkAdded.setListId(listId);
          linkAdded.setListItem(item);
        }
      }
      item++;
    }
    listId++;
  }
}
de.tudarmstadt.ukp.wikipedia.parserNestedListContainer

Javadoc

Take a Look a NestedList description first.

Most used methods

  • getNestedLists
  • <init>
  • add
  • empty
  • getNestedList
    Returns the NestedListContainer or NestedListElement at Positon i.
  • getSrcSpan
  • isNumbered
    Returns if the NestedList is a numbered or a unnumbered/pointed NestedList
  • remove
  • setSrcSpan
  • size

Popular in Java

  • Making http requests using okhttp
  • requestLocationUpdates (LocationManager)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • getContentResolver (Context)
  • ServerSocket (java.net)
    This class represents a server-side socket that waits for incoming client connections. A ServerSocke
  • Permission (java.security)
    Legacy security code; do not use.
  • LinkedHashMap (java.util)
    LinkedHashMap is an implementation of Map that guarantees iteration order. All optional operations a
  • Random (java.util)
    This class provides methods that return pseudo-random values.It is dangerous to seed Random with the
  • ConcurrentHashMap (java.util.concurrent)
    A plug-in replacement for JDK1.5 java.util.concurrent.ConcurrentHashMap. This version is based on or
  • Executor (java.util.concurrent)
    An object that executes submitted Runnable tasks. This interface provides a way of decoupling task s
  • Top 15 Vim Plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now