Orzu Ionut
3 years ago
11 changed files with 237 additions and 63 deletions
-
18app/Console/Commands/RunSearchDisplace.php
-
9app/Http/Controllers/FileController.php
-
2app/SearchDisplace/Ingest/HandleReceivedDocument.php
-
51app/SearchDisplace/Ingest/SendDocument.php
-
34app/SearchDisplace/SearchAndDisplaceFromFiles.php
-
6app/SearchDisplace/Searchers/Searcher.php
-
36demo-cli/README.md
-
BINdemo-cli/demo_document.pdf
-
31demo-cli/demo_searcher.json
-
82public/js/app.js
-
31resources/js/components/Home/Home.ts
@ -0,0 +1,36 @@ |
|||||
|
# Running S&D via CLI |
||||
|
|
||||
|
### Command |
||||
|
`php artisan sd:run {path} {searchers*}` |
||||
|
|
||||
|
The command accepts two arguments: |
||||
|
- path: The path to the document file on which the Search&Displace will run |
||||
|
- searchers: This argument can be one of the following two types: |
||||
|
- file searchers: the argument must only have one group in the format 'path:replace_with', where path is the path to a **valid JSON** file |
||||
|
- inline searchers: the argument can have multiple groups of inline searchers in the format 'key: replace_with'. |
||||
|
The 'key' represents a valid searcher found in the 'storage/app/searchers' directory, without the '.json' extension. |
||||
|
|
||||
|
The 'replace_with' value is optional, not using it will remove the found text strings. |
||||
|
|
||||
|
The resulted Markdown document will be created in the same directory as the input document file. |
||||
|
|
||||
|
### Examples |
||||
|
Note! These examples work when running the command from the root app directory, otherwise you have to |
||||
|
input the correct paths in the command, including for the 'artisan' file. |
||||
|
|
||||
|
- Using valid JSON file searcher and removing all strings found |
||||
|
`php artisan sd:run ./demo-cli/demo_document.pdf ./demo-cli/demo_searcher.json` |
||||
|
|
||||
|
- Using valid JSON file searcher and replacing all strings found with the string 'EMAIL' |
||||
|
`php artisan sd:run ./demo-cli/demo_document.pdf ./demo-cli/demo_searcher.json:EMAIL` |
||||
|
|
||||
|
- Using valid searcher key (which exists in the directory 'storage/app/searchers') and removing all strings found |
||||
|
`php artisan sd:run ./demo-cli/demo_document.pdf demo_searcher:EMAIL` |
||||
|
|
||||
|
- Using valid searcher key (which exists in the directory 'storage/app/searchers') and replacing all strings found with the string 'EMAIL' |
||||
|
`php artisan sd:run ./demo-cli/demo_document.pdf demo_searcher:EMAIL` |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
@ -0,0 +1,31 @@ |
|||||
|
{ |
||||
|
"id": "Demo Searcher", |
||||
|
"name": "Emails containing john", |
||||
|
"description": "Finds email addresses and then filters out those which don't contain the string 'john'.", |
||||
|
"rows": [ |
||||
|
[ |
||||
|
{ |
||||
|
"name": "Email", |
||||
|
"id": "email", |
||||
|
"description": null, |
||||
|
"type": "duckling" |
||||
|
} |
||||
|
], |
||||
|
|
||||
|
[ |
||||
|
{ |
||||
|
"id": "e97aa284061b58311423d4b0cccf596a_Contains john", |
||||
|
"name": "Contains john", |
||||
|
"description": null, |
||||
|
"rows": [ |
||||
|
[ |
||||
|
{ |
||||
|
"expression": ".*john.*" |
||||
|
} |
||||
|
] |
||||
|
], |
||||
|
"type": "custom" |
||||
|
} |
||||
|
] |
||||
|
] |
||||
|
} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue