Add agstat to benchmark

This commit is contained in:
Vinayak Mehta
2018-09-12 02:05:34 +05:30
parent 3b2d434ee9
commit dc533e73e2
10 changed files with 150 additions and 86 deletions
+74
View File
@@ -0,0 +1,74 @@
.. _cli:
Command-line interface
======================
::
$ camelot --help
Usage: camelot [OPTIONS] FILEPATH
Options:
-p, --pages TEXT Comma-separated page numbers to parse.
Example: 1,3,4 or 1,4-end
-o, --output TEXT Output filepath.
-f, --format [csv|json|excel|html]
Output file format.
-z, --zip Whether or not to create a ZIP archive.
-m, --mesh Whether or not to use Lattice method of
parsing. Stream is used by default.
-T, --table_area TEXT Table areas (x1,y1,x2,y2) to process.
x1, y1
-> left-top and x2, y2 -> right-bottom
-split, --split_text Whether or not to split text if it spans
across multiple cells.
-flag, --flag_size (inactive) Whether or not to flag text which
has uncommon size. (Useful to detect
super/subscripts)
-M, --margins <FLOAT FLOAT FLOAT>...
char_margin, line_margin, word_margin for
PDFMiner.
-C, --columns TEXT x-coordinates of column separators.
-r, --row_close_tol INTEGER Rows will be formed by combining text
vertically within this tolerance.
-c, --col_close_tol INTEGER Columns will be formed by combining text
horizontally within this tolerance.
-back, --process_background (with --mesh) Whether or not to process
lines that are in background.
-scale, --line_size_scaling INTEGER
(with --mesh) Factor by which the page
dimensions will be divided to get smallest
length of detected lines.
-copy, --copy_text [h|v] (with --mesh) Specify direction in which
text will be copied over in a spanning cell.
-shift, --shift_text [l|r|t|b] (with --mesh) Specify direction in which
text in a spanning cell should flow.
-l, --line_close_tol INTEGER (with --mesh) Tolerance parameter used to
merge close vertical lines and close
horizontal lines.
-j, --joint_close_tol INTEGER (with --mesh) Tolerance parameter used to
decide whether the detected lines and points
lie close to each other.
-block, --threshold_blocksize INTEGER
(with --mesh) For adaptive thresholding,
size of a pixel neighborhood that is used to
calculate a threshold value for the pixel:
3, 5, 7, and so on.
-const, --threshold_constant INTEGER
(with --mesh) For adaptive thresholding,
constant subtracted from the mean or
weighted mean.
Normally, it is positive but
may be zero or negative as well.
-I, --iterations INTEGER (with --mesh) Number of times for
erosion/dilation is applied.
-G, --geometry_type [text|table|contour|joint|line]
Plot geometry found on pdf page for
debugging.
text: Plot text objects. (Useful to get
table_area and columns coordinates)
table: Plot parsed table.
contour (with --mesh): Plot detected rectangles.
joint (with --mesh): Plot detected line intersections.
line (with --mesh): Plot detected lines.
--help Show this message and exit.
+7 -7
View File
@@ -17,7 +17,7 @@ Line segments are detected in the first step.
.. .. _this: insert link for us-030.pdf
.. image:: ../_static/user/line.png
.. image:: ../_static/png/line.png
:height: 674
:width: 1366
:scale: 50%
@@ -25,7 +25,7 @@ Line segments are detected in the first step.
The detected line segments are overlapped by `and` ing their pixel intensities to find intersections.
.. image:: ../_static/user/intersection.png
.. image:: ../_static/png/intersection.png
:height: 674
:width: 1366
:scale: 50%
@@ -33,7 +33,7 @@ The detected line segments are overlapped by `and` ing their pixel intensities t
The detected line segments are overlapped again, this time by `or` ing their pixel intensities and outermost contours are computed to identify potential table boundaries. This helps Lattice in detecting more than one table on a single page.
.. image:: ../_static/user/contour.png
.. image:: ../_static/png/contour.png
:height: 674
:width: 1366
:scale: 50%
@@ -41,7 +41,7 @@ The detected line segments are overlapped again, this time by `or` ing their pix
Since dimensions of a pdf and its image vary; table contours, intersections and segments are scaled and translated to the pdf's coordinate space. A representation of the table is then created using these scaled coordinates.
.. image:: ../_static/user/table.png
.. image:: ../_static/png/table.png
:height: 674
:width: 1366
:scale: 50%
@@ -49,7 +49,7 @@ Since dimensions of a pdf and its image vary; table contours, intersections and
Spanning cells are then detected using the line segments and intersections.
.. image:: ../_static/user/table_span.png
.. image:: ../_static/png/table_span.png
:height: 674
:width: 1366
:scale: 50%
@@ -85,7 +85,7 @@ Let's consider this pdf file.
.. .. _this: insert link for row_span_1.pdf
.. image:: ../_static/user/scale_1.png
.. image:: ../_static/png/scale_1.png
:height: 674
:width: 1366
:scale: 50%
@@ -93,7 +93,7 @@ Let's consider this pdf file.
Clearly, it couldn't detected those small lines in the lower left part. Therefore, we need to increase the value of scale. Let's try a value of 40.
.. image:: ../_static/user/scale_2.png
.. image:: ../_static/png/scale_2.png
:height: 674
:width: 1366
:scale: 50%
+1 -1
View File
@@ -68,7 +68,7 @@ We can also specify the column x-coordinates. We need to call Stream with debug=
>>> manager = Pdf(Stream(debug=True), 'mexican_towns.pdf'), debug=True
>>> manager.debug_plot()
.. image:: ../_static/user/columns.png
.. image:: ../_static/png/columns.png
:height: 674
:width: 1366
:scale: 50%