private int extractOneTable ( int lineNumber , ArrayList < TextPiece > linesOfAPage , String keyword , TableCandidate tc , ArrayList < TextPiece > wordsOfAPage , int i , int prevTableEndIndex , ArrayList < ArrayList < TextPiece > > linesByPage ) { TextPiece line = linesOfAPage . get ( lineNumber ) ; if ( line . getX ( ) < 0 && line . getWidth ( ) == 0.0 ) { System . out . println ( "\n This is a reversed table, currently we do not support such tables!" ) ; lineNumber ++ ; tc . setValid ( false ) ; } else { lineNumber = findCaptionBoundary ( lineNumber , linesOfAPage , tc ) ; if ( tc . isValid ( ) ) { tc . setPageId_thisTable ( i ) ; // getReferenceTableTexts(tc, linesByPage); isWideTable ( tc ) ; Vector distinctY = new Vector ( ) ; Vector piecesEachY = new Vector ( ) ; distinctY = getDistinctSortedY ( distinctY , piecesEachY , wordsOfAPage , tc ) ; boolean aboveCaption = judgeCaptionLocation ( linesOfAPage , tc , distinctY , wordsOfAPage ) ; lineNumber = findBodyBoundary ( lineNumber , linesOfAPage , tc , aboveCaption , prevTableEndIndex ) ; getReferenceTableTexts ( tc , linesByPage ) ; // System.out.println(tc.getRefText()); } tc . setHighLevelMeta ( i ) ; if ( tc . isValid ( ) ) { organizeCells ( linesOfAPage , tc ) ; } if ( tc . isValid ( ) ) { findFootnoteBeginRow ( tc ) ; } if ( tc . isValid ( ) ) { determineFootnoteHeading ( tc ) ; getColumnBoundaryWithoutHeading ( tc ) ; } int cc = tc . getColumnNum_thisTable ( ) ; if ( cc > 20 ) { tc . setValid ( false ) ; } else { // if((cc>=2) && (tc.getMaxColumnNumber()<cc*2) ) { //if we // treat each line as the possible table beginning without // considering the table keyword, we need use this if ( cc >= 2 ) { getTableStructure ( cc , tc , wordsOfAPage ) ; // if (tc.isValid()) parameters.tableNum++; } else { tc . setEmptyMetadataStructureLevel ( tc . getRows ( ) . size ( ) , cc , wordsOfAPage , m_docInfo ) ; } } } return lineNumber ; }
Extracts a table if detecting a potential table caption