-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Romuald Rousseau
committed
Apr 30, 2024
1 parent
a6ccd05
commit 6b3ba74
Showing
14 changed files
with
117 additions
and
282 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Tutorial 10 - Make a classifier from scratch | ||
|
||
[View source on GitHub](https://github.com/RomualdRousseau/Any2Json-Examples). | ||
|
||
This tutoral is a continuation of the [Tutorial 9](tutorial_9.md). | ||
|
||
***Coming soon*** | ||
|
||
## Conclusion | ||
|
||
Congratulations! You have loaded documents using Any2Json. | ||
|
||
For more examples of using Any2Json, check out the [tutorials](index.md). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Tutorial 9 - Browse the table grah | ||
|
||
[View source on GitHub](https://github.com/RomualdRousseau/Any2Json-Examples). | ||
|
||
This tutoral is a continuation of the [Tutorial 8](tutorial_8.md). | ||
|
||
***Coming soon*** | ||
|
||
## Conclusion | ||
|
||
Congratulations! You have loaded documents using Any2Json. | ||
|
||
For more examples of using Any2Json, check out the [tutorials](index.md). |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
from pyany2json import ModelBuilder, LayexTableParser, DocumentFactory, INTELLI_LAYOUT | ||
from pyany2json.document_factory import DataTable, TableGraph | ||
|
||
|
||
REPO_BASE_URL = "https://raw.githubusercontent.com/RomualdRousseau/Any2Json-Models/main" | ||
MODEL_NAME = "sales-english" | ||
FILE_PATH = "data/AG120-N-074.pdf" | ||
FILE_ENCODING = "UTF-8" | ||
|
||
|
||
builder = ModelBuilder().fromURI("{0}/{1}/{1}.json".format(REPO_BASE_URL, MODEL_NAME)) | ||
parser = LayexTableParser( | ||
[""], ["((vv$)(v+$v+$))(()(.+$)())+()", "(()(.+$))(()(.+$)())+()"] | ||
) | ||
model = ( | ||
builder.setTableParser(parser) | ||
.build() | ||
) | ||
|
||
def visitTable(parent: TableGraph): | ||
for c in parent.children(): | ||
table = c.getTable() | ||
if isinstance(table, DataTable): | ||
for header in table.headers(): | ||
print(header.getName(), end=" ") | ||
print() | ||
for row in table.rows(): | ||
for cell in row.cells(): | ||
print(cell.getValue(), end=" ") | ||
print() | ||
if len(c.children()) > 0: | ||
visitTable(c) | ||
|
||
with DocumentFactory.createInstance(FILE_PATH, FILE_ENCODING) as doc: | ||
doc.setModel(model) | ||
doc.setHints([INTELLI_LAYOUT]) | ||
for sheet in doc.sheets(): | ||
root = sheet.getTableGraph() | ||
if root.isPresent(): | ||
visitTable(root.get()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
site_name: Any2Json Documents | ||
site_name: PyAny2Json Documents | ||
nav: | ||
- Home: index.md | ||
- How it works: how_it_works.md | ||
- White Papers: white_papers.md | ||
|
Oops, something went wrong.