Add various metrics to score the quality of a parse

Add various metrics to score the quality of a parse
This commit is contained in:
Vinayak Mehta
2016-08-30 14:52:49 +05:30
committed by GitHub
parent 43a009dab4
commit 552f9cf422
11 changed files with 1027 additions and 472 deletions
+1 -1
View File
@@ -39,7 +39,7 @@ Usage
>>> extractor = Lattice(Pdf('us-030.pdf'))
>>> tables = extractor.get_tables()
>>> print tables['pg-1']
>>> print tables['page-1'][0]
.. csv-table::
:header: "Cycle Name","KI (1/km)","Distance (mi)","Percent Fuel Savings","","",""
+3 -3
View File
@@ -65,7 +65,7 @@ Finally, the characters found on the page are assigned to cells based on their x
>>> extractor = Lattice(Pdf('us-030.pdf'))
>>> tables = extractor.get_tables()
>>> print tables['pg-1']
>>> print tables['page-1'][0]
.. csv-table::
:header: "Cycle Name","KI (1/km)","Distance (mi)","Percent Fuel Savings","","",""
@@ -114,7 +114,7 @@ In the PDF used above, you can see that some cells spanned a lot of rows, `fill`
>>> extractor = Lattice(Pdf('row_span_1.pdf'), fill='v', scale=40)
>>> tables = extractor.get_tables()
>>> print tables['pg-1']
>>> print tables['page-1'][0]
.. csv-table::
:header: "Plan Type","County","Plan Name","Totals"
@@ -173,7 +173,7 @@ To find line segments, Lattice needs the lines of the PDF to be in foreground. S
>>> extractor = Lattice(Pdf('lines_in_background_1.pdf'), invert=True)
>>> tables = extractor.get_tables()
>>> print tables['pg-1']
>>> print tables['page-1'][0]
.. csv-table::
:header: "State","Date","Halt stations","Halt days","Persons directly reached(in lakh)","Persons trained","Persons counseled","Persons testedfor HIV"
+4 -4
View File
@@ -17,7 +17,7 @@ Let's run it on this PDF.
>>> extractor = Stream(Pdf('eu-027.pdf'))
>>> tables = extractor.get_tables()
>>> print tables['pg-1']
>>> print tables['page-1'][0]
.. .. _this: insert link for eu-027.pdf
@@ -68,7 +68,7 @@ But sometimes its guess could be incorrect, like in this case.
>>> extractor = Stream(Pdf('missing_values.pdf'))
>>> tables = extractor.get_tables()
>>> print tables['pg-1']
>>> print tables['page-1'][0]
.. .. _this: insert link for missing_values.pdf
@@ -127,7 +127,7 @@ It guessed that the PDF has 3 columns, because there wasn't any data in the last
>>> extractor = Stream(Pdf('missing_values.pdf'), ncolumns=5)
>>> tables = extractor.get_tables()
>>> print tables['pg-1']
>>> print tables['page-1'][0]
.. csv-table::
@@ -200,7 +200,7 @@ After getting the x-coordinates, we just need to pass them to Stream, like this.
>>> extractor = Stream(Pdf('mexican_towns.pdf'), columns='28,67,180,230,425,475,700')
>>> tables = extractor.get_tables()
>>> print tables['pg-1']
>>> print tables['page-1'][0]
.. csv-table::