#created on: Jul 30, 2010 package edu.isi.bmkeg.pdf.classification.rules #list any import classes here. import edu.isi.bmkeg.pdf.features.ChunkFeatures; import edu.isi.bmkeg.pdf.model.ChunkBlock; #declare any global variables here global ChunkBlock chunk; rule "Title" activation-group "blockClassification" salience 4 when ChunkFeatures(pageNumber==1) ChunkFeatures(mostPopularFontSize==20) eval(chunk.getNumberOfLine()<=6) ChunkFeatures(allignedMiddle==true) then chunk.setType(chunk.TYPE_TITLE); end rule "Authors" activation-group "blockClassification" salience 4 when ChunkFeatures(pageNumber==1) ChunkFeatures(mostPopularFontSize==10) eval(chunk.getNumberOfLine()<=6) ChunkFeatures(allignedMiddle==true) features:ChunkFeatures() eval(features.isMatchingRegularExpression("^(Summ|[Aa]bst|SUMM|ABST)")==false) then chunk.setType(chunk.TYPE_AUTHORS); end rule "Header" activation-group "blockClassification" salience 4 when eval(chunk.getNumberOfLine()==1) ChunkFeatures(containingFirstLineOfPage==true) then chunk.setType(chunk.TYPE_HEADER); end rule "Footer" activation-group "blockClassification" salience 4 when eval(chunk.getNumberOfLine()==1) ChunkFeatures(containingLastLineOfPage==true) then chunk.setType(chunk.TYPE_FOOTER); end rule "Abstract Heading" activation-group "blockClassification" salience 3 when ChunkFeatures(pageNumber==1) eval(chunk.getNumberOfLine()==1) ChunkFeatures(allignedLeft==true) features:ChunkFeatures() eval(features.isMatchingRegularExpression("^(Summ|[Aa]bst|SUMM|ABST)")==true) then chunk.setType(chunk.TYPE_ABSTRACT_HEADING); end rule "Abstract body" activation-group "blockClassification" salience 1 when ChunkFeatures(pageNumber==1) ChunkFeatures(mostPopularFontSize==9) ChunkFeatures(section=='abstract') then chunk.setType(chunk.TYPE_ABSTRACT_BODY); end rule "Introduction Heading" activation-group "blockClassification" salience 3 when ChunkFeatures(mostPopularFontSize==10) ChunkFeatures(allignedMiddle==false) features:ChunkFeatures() eval(features.isMatchingRegularExpression("^(Intr|INTR)")==true) then chunk.setType(chunk.TYPE_INTRODUCTION_HEADING); end rule "Introduction Body" activation-group "blockClassification" salience 1 when ChunkFeatures(mostPopularFontSize==9) ChunkFeatures(allignedMiddle==false) ChunkFeatures(allignedWithColumnBoundaries==true) ChunkFeatures(chunkTextLength>25) (ChunkFeatures(section=="introduction") or ChunkFeatures(section=="keywords") or ChunkFeatures(section=="abstract")) then chunk.setType(chunk.TYPE_INTRODUCTION_BODY); end rule "Introduction Subtitle" activation-group "blockClassification" salience 2 when ChunkFeatures(mostPopularFontSize==10) eval(chunk.getNumberOfLine()<=2) ChunkFeatures(section=="introduction") then chunk.setType(chunk.TYPE_INTRODUCTION_SUBTITLE); end rule "Method Heading" activation-group "blockClassification" salience 3 when ChunkFeatures(mostPopularFontSize==10) eval(chunk.getNumberOfLine()==1) features:ChunkFeatures() eval(features.isMatchingRegularExpression("^(MATE|METH|Mate|Meth)")==true) then chunk.setType(chunk.TYPE_METHODS_HEADING); end rule "Method Subtitle" activation-group "blockClassification" salience 2 when ChunkFeatures(mostPopularFontSize==10) eval(chunk.getNumberOfLine()<=2) ChunkFeatures(section=="methods") then chunk.setType(chunk.TYPE_METHODS_SUBTITLE); end rule "Method Body" activation-group "blockClassification" salience 1 when ChunkFeatures(mostPopularFontSize==9) ChunkFeatures(chunkTextLength>10) ChunkFeatures(section=="methods") then chunk.setType(chunk.TYPE_METHODS_BODY); end rule "Supporting Information Heading" activation-group "blockClassification" salience 3 when ChunkFeatures(mostPopularFontSize==10) eval(chunk.getNumberOfLine()==1) features:ChunkFeatures() eval(features.isMatchingRegularExpression("^(Sup|SUP)")==true) then chunk.setType(chunk.TYPE_SUPPORTING_INFORMATION_HEADING); end rule "Supporting Information Subtitle" activation-group "blockClassification" salience 2 when ChunkFeatures(mostPopularFontSize==10) eval(chunk.getNumberOfLine()<=2) ChunkFeatures(section=="supportingInformation") then chunk.setType(chunk.TYPE_SUPPORTING_INFORMATION_SUBTITLE); end rule "Supporting Information Body" activation-group "blockClassification" salience 1 when ChunkFeatures(mostPopularFontSize==10) ChunkFeatures(chunkTextLength>10) ChunkFeatures(section=="supportingInformation"||section=="references") then chunk.setType(chunk.TYPE_SUPPORTING_INFORMATION_BODY); end rule "Result Heading" activation-group "blockClassification" salience 3 when ChunkFeatures(mostPopularFontSize==10) eval(chunk.getNumberOfLine()==1) ChunkFeatures(allignedMiddle==false) features:ChunkFeatures() eval(features.isMatchingRegularExpression("^(Res|RES|OBS|Obs)")==true) then chunk.setType(chunk.TYPE_RESULTS_HEADING); end rule "Result Body" activation-group "blockClassification" salience 1 when ChunkFeatures(mostPopularFontSize==9) ChunkFeatures(chunkTextLength>10) ChunkFeatures(section=="results") then chunk.setType(chunk.TYPE_RESULTS_BODY); end rule "Result Subtitle" activation-group "blockClassification" salience 2 when ChunkFeatures(mostPopularFontSize==10) eval(chunk.getNumberOfLine()<=2) ChunkFeatures(allignedMiddle==false) ChunkFeatures(mostPopularFontModifierBold==false) ChunkFeatures(section=="results") then chunk.setType(chunk.TYPE_RESULTS_SUBTITLE); end rule "Reference Heading" activation-group "blockClassification" salience 3 when ChunkFeatures(pageNumber>1) ChunkFeatures(mostPopularFontSize==10) ChunkFeatures(allignedMiddle==false) features:ChunkFeatures() eval(features.isMatchingRegularExpression("^(Refe|REFE|Lite|LITE)")==true) then chunk.setType(chunk.TYPE_REFERENCES_HEADING); end rule "Reference Body1" activation-group "blockClassification" salience 1 when ChunkFeatures(mostPopularFontSize==7) ChunkFeatures(pageNumber>1) ChunkFeatures(chunkTextLength>10) ChunkFeatures(section=="references") then chunk.setType(chunk.TYPE_REFERENCES_BODY); end rule "Reference Body2" activation-group "blockClassification" salience 1 when ChunkFeatures(mostPopularFontSize==7) ChunkFeatures(chunkTextLength>10) ChunkFeatures(pageNumber>1) then chunk.setType(chunk.TYPE_REFERENCES_BODY); end rule "Discussion Heading" activation-group "blockClassification" salience 3 when ChunkFeatures(mostPopularFontSize==10) eval(chunk.getNumberOfLine()==1) ChunkFeatures(allignedMiddle==false) features:ChunkFeatures() eval(features.isMatchingRegularExpression("^(Disc|DISC)")==true) then chunk.setType(chunk.TYPE_DISCUSSION_HEADING); end rule "Discussion Body" activation-group "blockClassification" salience 1 when ChunkFeatures(mostPopularFontSize==9) ChunkFeatures(allignedMiddle==false) ChunkFeatures(allignedWithColumnBoundaries==true) ChunkFeatures(chunkTextLength>10) ChunkFeatures(section=="discussion") then chunk.setType(chunk.TYPE_DISCUSSION_BODY); end rule "Discussion Subtitle" activation-group "blockClassification" salience 2 when ChunkFeatures(mostPopularFontSize==10) eval(chunk.getNumberOfLine()<=2) ChunkFeatures(allignedMiddle==false) ChunkFeatures(section=="discussion") ChunkFeatures(mostPopularFontModifierBold==false) then chunk.setType(chunk.TYPE_DISCUSSION_SUBTITLE); end rule "Acknowledgement Heading" activation-group "blockClassification" salience 3 when eval(chunk.getNumberOfLine()==1) ChunkFeatures(allignedMiddle==false) features:ChunkFeatures() eval(features.isMatchingRegularExpression("^(ACKN|Ackn)")==true) then chunk.setType(chunk.TYPE_ACKNOWLEDGEMENTS_HEADING); end rule "Acknowledgement Body" activation-group "blockClassification" salience 1 when ChunkFeatures(mostPopularFontSize==8) ChunkFeatures(chunkTextLength>10) ChunkFeatures(section=="acknowledgements") then chunk.setType(chunk.TYPE_ACKNOWLEDGEMENTS_BODY); end rule "Figure Legend 1" activation-group "blockClassification" when ChunkFeatures(mostPopularFontSize==8) features:ChunkFeatures() eval(features.isMatchingRegularExpression("^Fig")==true) then chunk.setType(chunk.TYPE_FIGURE_LEGEND); end rule "Figure Legend 2" activation-group "blockClassification" when ChunkFeatures(mostPopularFontSize==8) ChunkFeatures(lastClassification=="figureLegend") ChunkFeatures(chunkTextLength>30) then chunk.setType(chunk.TYPE_FIGURE_LEGEND); end rule "Figure Legend 3" activation-group "blockClassification" when ChunkFeatures(mostPopularFontSize==8) features:ChunkFeatures() eval(features.hasNeighboursOfType("figureLegend",features.WEST)==true) then chunk.setType(chunk.TYPE_FIGURE_LEGEND); end rule "Table 1" activation-group "blockClassification" salience 4 when ChunkFeatures(heightDifferenceBetweenChunkWordAndDocumentWord<=-2) #eval(chunk.getNumberOfLine()==1) features:ChunkFeatures() eval(features.isMatchingRegularExpression("^(Tab|TABL|A\\s*bbr)")==true) then chunk.setType(chunk.TYPE_TABLE); end rule "Table 2" activation-group "blockClassification" salience 4 when ChunkFeatures(heightDifferenceBetweenChunkWordAndDocumentWord<=-2) ChunkFeatures(lastClassification=="table") then chunk.setType(chunk.TYPE_TABLE); end