mindee 2.0.0 → 2.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/.yardopts +0 -1
  4. data/CHANGELOG.md +15 -0
  5. data/README.md +13 -9
  6. data/Rakefile +9 -1
  7. data/bin/mindee.rb +8 -0
  8. data/docs/code_samples/bank_account_details_v1.txt +14 -0
  9. data/docs/code_samples/bank_check_v1.txt +14 -0
  10. data/docs/code_samples/carte_vitale_v1.txt +14 -0
  11. data/docs/code_samples/custom_v1.txt +24 -0
  12. data/docs/code_samples/default.txt +16 -0
  13. data/docs/code_samples/expense_receipts_v4.txt +14 -0
  14. data/docs/code_samples/financial_document_v1.txt +14 -0
  15. data/docs/code_samples/idcard_fr_v1.txt +14 -0
  16. data/docs/code_samples/invoices_v4.txt +14 -0
  17. data/docs/code_samples/license_plates_v1.txt +14 -0
  18. data/docs/code_samples/passport_v1.txt +14 -0
  19. data/docs/code_samples/proof_of_address_v1.txt +14 -0
  20. data/docs/code_samples/shipping_containers_v1.txt +14 -0
  21. data/docs/ruby-api-builder.md +35 -42
  22. data/docs/ruby-getting-started.md +2 -2
  23. data/docs/ruby-invoice-ocr.md +12 -13
  24. data/docs/ruby-passport-ocr.md +1 -1
  25. data/docs/ruby-receipt-ocr.md +1 -1
  26. data/lib/mindee/client.rb +34 -30
  27. data/lib/mindee/document_config.rb +15 -23
  28. data/lib/mindee/parsing/prediction/financial_document/financial_document_v1.rb +245 -0
  29. data/lib/mindee/parsing/prediction/financial_document/invoice_line_item.rb +58 -0
  30. data/lib/mindee/parsing/prediction/passport/passport_v1.rb +0 -63
  31. data/lib/mindee/parsing/prediction/proof_of_address/proof_of_address_v1.rb +80 -0
  32. data/lib/mindee/parsing/prediction/receipt/receipt_v4.rb +3 -0
  33. data/lib/mindee/parsing/prediction.rb +2 -0
  34. data/lib/mindee/version.rb +1 -1
  35. data/mindee.gemspec +2 -3
  36. metadata +24 -22
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 729bb9b6e8643c95c194583c4c7e217f9cbdc68149a72125767a2191291142be
4
- data.tar.gz: cc2233ca32e0fadaf445e731417238b0fa272865f949fd0c91ef61916f86dfb4
3
+ metadata.gz: 927e4d22c8f54feebaace71c40705a1e130d4737fce8487ae24b7c369f2aa3ea
4
+ data.tar.gz: 99101cdf1573be19a82ee0cd04bd54cc45edff95bac113902174f45c3ae4de4d
5
5
  SHA512:
6
- metadata.gz: 162501228d7fed6ac0829aefcaae88390d43a91cd7b516a837471964b181fe084f9d200e6db447fb4c3b137c3f93ea801661e75ac151a087702143574b8ee9b6
7
- data.tar.gz: 960d67e2a53626d3399628b9190972025df886efe50791dc72e5cb0d327f49c99352c66361ff952912b30288c562d3169d2f67ec49a0f8310ed47b40aeedb11d
6
+ metadata.gz: 38b335f5baf0b8a4757e31956472314f11e01d901c24e8e24990f48e90292d0bac7c4aba79a30ea4db27188c88d7957282fc19d08c653b3b7fce489a923f6c9a
7
+ data.tar.gz: 8f87a88fff6e4284a326c563f60e67c8a85e2516cb96f103ba648b5ac2366298e59fc1c60f120f4e797b738c71dc391dc881317bd1e9825d2a3f9513f9b63e5d
data/.gitignore CHANGED
@@ -15,6 +15,7 @@
15
15
  /test/tmp/
16
16
  /test/version_tmp/
17
17
  /tmp/
18
+ /vendor
18
19
  /mindee-*/
19
20
 
20
21
  # Used by dotenv library to load environment variables.
data/.yardopts CHANGED
@@ -1,4 +1,3 @@
1
1
  --markup markdown
2
2
  --main README.md
3
- --files docs/ruby-getting-started.md,docs/ruby-invoice-ocr.md,docs/ruby-passport-ocr.md,docs/ruby-receipt-ocr.md
4
3
  --output-dir docs/_build
data/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # Mindee Ruby API Library Changelog
2
2
 
3
+ ## v2.1.1 - 2023-04-21
4
+ ### Changes
5
+ * :memo: minor docstring improvements
6
+ * :coffin: remove redundant local checks
7
+ * :memo: publish documentation
8
+ * :memo: add code samples
9
+
10
+
11
+ ## v2.1.0 - 2023-01-30
12
+ ### Changes
13
+ * :sparkles: Add financial document v1 support (Co-authored-by: Oriol Gual)
14
+ * :sparkles: Add Proof of Address v1 support
15
+
16
+
3
17
  ## v2.0.0 - 2023-01-13
4
18
  ### ¡Breaking Changes!
5
19
  * :sparkles: add improved PDF merge system
@@ -17,6 +31,7 @@
17
31
  * :white_check_mark: add testing on Ruby 3.2
18
32
  * :sparkles: allow setting the request timeout from env
19
33
 
34
+
20
35
  ## v1.2.0 - 2022-12-26
21
36
  ### Changes
22
37
  * :arrow_up: switch to origamindee => adds support for Ruby 3
data/README.md CHANGED
@@ -52,7 +52,7 @@ result = mindee_client.doc_from_path('/path/to/the/file.ext')
52
52
  .parse(Mindee::Prediction::EU::LicensePlateV1)
53
53
 
54
54
  # Print a full summary of the parsed data in RST format
55
- puts result.document
55
+ puts result
56
56
  ```
57
57
 
58
58
  ### Custom Document (API Builder)
@@ -61,13 +61,13 @@ require 'mindee'
61
61
 
62
62
  # Init a new client and configure your custom document
63
63
  mindee_client = Mindee::Client.new(api_key: 'my-api-key').add_endpoint(
64
- 'john',
65
- 'wnine'
64
+ 'my-account',
65
+ 'my-endpoint'
66
66
  )
67
67
 
68
68
  # Load a file from disk and parse it
69
69
  result = mindee_client.doc_from_path('/path/to/the/file.ext')
70
- .parse(Mindee::Prediction::CustomV1, endpoint_name: 'wnine')
70
+ .parse(Mindee::Prediction::CustomV1, endpoint_name: 'my-endpoint')
71
71
 
72
72
  # Print a full summary of the parsed data in RST format
73
73
  puts result
@@ -84,11 +84,15 @@ end
84
84
  There's more to it than that for those that need more features, or want to
85
85
  customize the experience.
86
86
 
87
- - [Ruby Overview](https://developers.mindee.com/docs/ruby-getting-started)
88
- - [Ruby Custom APIs OCR](https://developers.mindee.com/docs/ruby-api-builder)
89
- - [Ruby invoices OCR](https://developers.mindee.com/docs/ruby-invoice-ocr)
90
- - [Ruby receipts OCR](https://developers.mindee.com/docs/ruby-receipt-ocr)
91
- - [Ruby passports OCR](https://developers.mindee.com/docs/ruby-passport-ocr)
87
+ * [Ruby Overview](https://developers.mindee.com/docs/ruby-getting-started)
88
+ * [Ruby Custom APIs OCR](https://developers.mindee.com/docs/ruby-api-builder)
89
+ * [Ruby invoices OCR](https://developers.mindee.com/docs/ruby-invoice-ocr)
90
+ * [Ruby receipts OCR](https://developers.mindee.com/docs/ruby-receipt-ocr)
91
+ * [Ruby passports OCR](https://developers.mindee.com/docs/ruby-passport-ocr)
92
+
93
+ You can also take a look at the
94
+ [Reference Documentation](https://mindee.github.io/mindee-api-ruby/).
95
+
92
96
 
93
97
  ## License
94
98
  Copyright © Mindee, SA
data/Rakefile CHANGED
@@ -15,6 +15,14 @@ task default: :spec
15
15
 
16
16
  RSpec::Core::RakeTask.new(:spec)
17
17
 
18
- YARD::Rake::YardocTask.new do |task|
18
+ desc 'Generate documentation'
19
+ YARD::Rake::YardocTask.new(:doc) do |task|
19
20
  task.files = ['lib/**/*.rb']
20
21
  end
22
+
23
+ Rake::Task[:doc].enhance do
24
+ FileUtils.cp_r(
25
+ File.join('docs', 'code_samples'),
26
+ File.join('docs', '_build')
27
+ )
28
+ end
data/bin/mindee.rb CHANGED
@@ -10,6 +10,14 @@ DOCUMENTS = {
10
10
  help: "Custom document type from API builder",
11
11
  prediction: Mindee::Prediction::CustomV1,
12
12
  },
13
+ "proof-of-address" => {
14
+ help: 'Proof of Address',
15
+ prediction: Mindee::Prediction::ProofOfAddressV1,
16
+ },
17
+ "financial-document" => {
18
+ help: 'Financial Document',
19
+ prediction: Mindee::Prediction::FinancialDocumentV1,
20
+ },
13
21
  "invoice" => {
14
22
  help: 'Invoice',
15
23
  prediction: Mindee::Prediction::InvoiceV4,
@@ -0,0 +1,14 @@
1
+ require 'mindee'
2
+
3
+ # Init a new client
4
+ mindee_client = Mindee::Client.new(api_key: 'my-api-key')
5
+
6
+ # Load a file from disk and parse it
7
+ result = mindee_client.doc_from_path('/path/to/the/file.ext')
8
+ .parse(Mindee::Prediction::FR::BankAccountDetailsV1)
9
+
10
+ # Print a full summary of the parsed data in RST format
11
+ puts result
12
+
13
+ # Print the document-level parsed data
14
+ # puts result.inference.prediction
@@ -0,0 +1,14 @@
1
+ require 'mindee'
2
+
3
+ # Init a new client
4
+ mindee_client = Mindee::Client.new(api_key: 'my-api-key')
5
+
6
+ # Load a file from disk and parse it
7
+ result = mindee_client.doc_from_path('/path/to/the/file.ext')
8
+ .parse(Mindee::Prediction::US::BankCheckV1)
9
+
10
+ # Print a full summary of the parsed data in RST format
11
+ puts result
12
+
13
+ # Print the document-level parsed data
14
+ # puts result.inference.prediction
@@ -0,0 +1,14 @@
1
+ require 'mindee'
2
+
3
+ # Init a new client
4
+ mindee_client = Mindee::Client.new(api_key: 'my-api-key')
5
+
6
+ # Load a file from disk and parse it
7
+ result = mindee_client.doc_from_path('/path/to/the/file.ext')
8
+ .parse(Mindee::Prediction::FR::CarteVitaleV1)
9
+
10
+ # Print a full summary of the parsed data in RST format
11
+ puts result
12
+
13
+ # Print the document-level parsed data
14
+ # puts result.inference.prediction
@@ -0,0 +1,24 @@
1
+ require 'mindee'
2
+
3
+ # Init a new client and configure your custom document
4
+ mindee_client = Mindee::Client.new(api_key: 'my-api-key').add_endpoint(
5
+ 'my-account',
6
+ 'my-endpoint'
7
+ )
8
+
9
+ # Load a file from disk and parse it
10
+ result = mindee_client.doc_from_path('/path/to/the/file.ext')
11
+ .parse(Mindee::Prediction::CustomV1, endpoint_name: 'my-endpoint')
12
+
13
+ # Print a full summary of the parsed data in RST format
14
+ puts result
15
+
16
+ # Print the document-level parsed data
17
+ # puts result.inference.prediction
18
+
19
+ # Looping over all prediction values
20
+ result.inference.prediction.fields.each do |field_name, field_data|
21
+ puts field_name
22
+ puts field_data.values
23
+ puts field_data.to_s
24
+ end
@@ -0,0 +1,16 @@
1
+ require 'uri'
2
+ require 'net/http'
3
+ require 'net/https'
4
+
5
+ url = URI('https://api.mindee.net/v1/products/mindee/my-endpoint/my-version/predict')
6
+ file = '/path/to/the/file.ext'
7
+
8
+ http = Net::HTTP.new(url.host, url.port)
9
+ http.use_ssl = true
10
+
11
+ request = Net::HTTP::Post.new(url)
12
+ request['Authorization'] = 'Token my-api-key'
13
+ request.set_form([['document', File.open(file)]], 'multipart/form-data')
14
+
15
+ response = http.request(request)
16
+ puts response.read_body
@@ -0,0 +1,14 @@
1
+ require 'mindee'
2
+
3
+ # Init a new client
4
+ mindee_client = Mindee::Client.new(api_key: 'my-api-key')
5
+
6
+ # Load a file from disk and parse it
7
+ result = mindee_client.doc_from_path('/path/to/the/file.ext')
8
+ .parse(Mindee::Prediction::ReceiptV4)
9
+
10
+ # Print a full summary of the parsed data in RST format
11
+ puts result
12
+
13
+ # Print the document-level parsed data
14
+ # puts result.inference.prediction
@@ -0,0 +1,14 @@
1
+ require 'mindee'
2
+
3
+ # Init a new client
4
+ mindee_client = Mindee::Client.new(api_key: 'my-api-key')
5
+
6
+ # Load a file from disk and parse it
7
+ result = mindee_client.doc_from_path('/path/to/the/file.ext')
8
+ .parse(Mindee::Prediction::FinancialDocumentV1)
9
+
10
+ # Print a full summary of the parsed data in RST format
11
+ puts result
12
+
13
+ # Print the document-level parsed data
14
+ # puts result.inference.prediction
@@ -0,0 +1,14 @@
1
+ require 'mindee'
2
+
3
+ # Init a new client
4
+ mindee_client = Mindee::Client.new(api_key: 'my-api-key')
5
+
6
+ # Load a file from disk and parse it
7
+ result = mindee_client.doc_from_path('/path/to/the/file.ext')
8
+ .parse(Mindee::Prediction::FR::IdCardV1)
9
+
10
+ # Print a full summary of the parsed data in RST format
11
+ puts result
12
+
13
+ # Print the document-level parsed data
14
+ # puts result.inference.prediction
@@ -0,0 +1,14 @@
1
+ require 'mindee'
2
+
3
+ # Init a new client
4
+ mindee_client = Mindee::Client.new(api_key: 'my-api-key')
5
+
6
+ # Load a file from disk and parse it
7
+ result = mindee_client.doc_from_path('/path/to/the/file.ext')
8
+ .parse(Mindee::Prediction::InvoiceV4)
9
+
10
+ # Print a full summary of the parsed data in RST format
11
+ puts result
12
+
13
+ # Print the document-level parsed data
14
+ # puts result.inference.prediction
@@ -0,0 +1,14 @@
1
+ require 'mindee'
2
+
3
+ # Init a new client
4
+ mindee_client = Mindee::Client.new(api_key: 'my-api-key')
5
+
6
+ # Load a file from disk and parse it
7
+ result = mindee_client.doc_from_path('/path/to/the/file.ext')
8
+ .parse(Mindee::Prediction::EU::LicensePlateV1)
9
+
10
+ # Print a full summary of the parsed data in RST format
11
+ puts result
12
+
13
+ # Print the document-level parsed data
14
+ # puts result.inference.prediction
@@ -0,0 +1,14 @@
1
+ require 'mindee'
2
+
3
+ # Init a new client
4
+ mindee_client = Mindee::Client.new(api_key: 'my-api-key')
5
+
6
+ # Load a file from disk and parse it
7
+ result = mindee_client.doc_from_path('/path/to/the/file.ext')
8
+ .parse(Mindee::Prediction::PassportV1)
9
+
10
+ # Print a full summary of the parsed data in RST format
11
+ puts result
12
+
13
+ # Print the document-level parsed data
14
+ # puts result.inference.prediction
@@ -0,0 +1,14 @@
1
+ require 'mindee'
2
+
3
+ # Init a new client
4
+ mindee_client = Mindee::Client.new(api_key: 'my-api-key')
5
+
6
+ # Load a file from disk and parse it
7
+ result = mindee_client.doc_from_path('/path/to/the/file.ext')
8
+ .parse(Mindee::Prediction::ProofOfAddressV1)
9
+
10
+ # Print a full summary of the parsed data in RST format
11
+ puts result
12
+
13
+ # Print the document-level parsed data
14
+ # puts result.inference.prediction
@@ -0,0 +1,14 @@
1
+ require 'mindee'
2
+
3
+ # Init a new client
4
+ mindee_client = Mindee::Client.new(api_key: 'my-api-key')
5
+
6
+ # Load a file from disk and parse it
7
+ result = mindee_client.doc_from_path('/path/to/the/file.ext')
8
+ .parse(Mindee::Prediction::ShippingContainerV1)
9
+
10
+ # Print a full summary of the parsed data in RST format
11
+ puts result
12
+
13
+ # Print the document-level parsed data
14
+ # puts result.inference.prediction
@@ -1,34 +1,32 @@
1
- The Ruby OCR SDK supports [custom-built API](https://developers.mindee.com/docs/build-your-first-document-parsing-api)
2
- from the API Builder.
1
+ The Ruby OCR SDK supports [custom-built API](https://developers.mindee.com/docs/build-your-first-document-parsing-api) from the API Builder.
3
2
 
4
3
  If your document isn't covered by one of Mindee's Off-the-Shelf APIs, you can create your own API using the
5
4
  [API Builder](https://developers.mindee.com/docs/overview).
6
5
 
7
- For the following examples, we are using our own [W9s custom API](https://developers.mindee.com/docs/w9-forms-ocr)
6
+ For the following examples, we are using our own [W9s custom API](https://developers.mindee.com/docs/w9-forms-ocr),
8
7
  created with the [API Builder](https://developers.mindee.com/docs/overview).
9
8
 
10
9
  > 📘 **Info**
11
10
  >
12
- > We used a data model that may be different from yours. To modify this to your own custom API,
13
- > change the `config_custom_doc` call with your own parameters.
11
+ > We used a data model that will be different from yours.
12
+ > To modify this to your own custom API, change the `add_endpoint` call with your own parameters.
14
13
 
15
14
  ```ruby
16
15
  require 'mindee'
17
16
 
18
17
  # Init a new client and configure your custom document
19
- mindee_client = Mindee::Client.new(
20
- api_key: 'my-api-key', # optional, can be set in environment
21
- ).config_custom_doc(
22
- 'wsnine',
18
+ mindee_client = Mindee::Client.new(api_key: 'my-api-key').add_endpoint(
23
19
  'john',
20
+ 'wnine',
24
21
  version: '1.1' # optional, if not set, use the latest version of the model
25
22
  )
26
23
 
27
24
  # Load a file from disk and parse it
28
- w9_data = mindee_client.doc_from_path('/path/to/file.pdf').parse('wsnine')
25
+ result = mindee_client.doc_from_path('/path/to/file.ext')
26
+ .parse(Mindee::Prediction::CustomV1, endpoint_name: 'wnine')
29
27
 
30
- # Print a brief summary of the parsed data
31
- puts w9_data.document.to_s
28
+ # Print a summary of the document prediction in RST format
29
+ puts result
32
30
  ```
33
31
 
34
32
  If the `version` argument is set, you'll be required to update it every time a new model is trained.
@@ -39,7 +37,8 @@ The client calls the `parse` method when parsing your custom document, which wil
39
37
  The document type must be specified when calling the parse method.
40
38
 
41
39
  ```ruby
42
- result = mindee_client.doc_from_path('/path/to/custom_file').parse('wsnine')
40
+ result = mindee_client.doc_from_path('/path/to/custom_file')
41
+ .parse(Mindee::Prediction::CustomV1, endpoint_name: 'wnine')
43
42
  puts result
44
43
  ```
45
44
 
@@ -49,13 +48,13 @@ puts result
49
48
  > you **must** specify your account name when calling the `parse` method:
50
49
 
51
50
  ```ruby
52
- mindee_client = Mindee::Client.new.config_custom_doc(
51
+ mindee_client = Mindee::Client.new.add_endpoint(
53
52
  'receipt',
54
53
  'john'
55
54
  )
56
55
 
57
56
  result = mindee_client.doc_from_path('/path/to/receipt.jpg')
58
- .parse('receipt', username: 'john')
57
+ .parse(Mindee::Prediction::CustomV1, account_name: 'john')
59
58
  ```
60
59
 
61
60
  ## Document Fields
@@ -64,64 +63,58 @@ All the fields defined in the API builder when creating your custom document are
64
63
  In custom documents, each field will hold an array of all the words in the document which are related to that field.
65
64
  Each word is an object that has the text content, geometry information, and confidence score.
66
65
 
67
- Value fields can be accessed either via the `fields` attribute, or as their own attributes set at run-time.
66
+ Value fields can be accessed via the `fields` attribute.
68
67
 
69
- Classification fields can be accessed either via the `classifications` attribute, or as their own attributes set at run-time.
68
+ Classification fields can be accessed via the `classifications` attribute.
70
69
 
71
70
  > 📘 **Info**
72
71
  >
73
72
  > Both document level and page level objects work in the same way.
74
73
 
75
- ### Run-time Attributes
76
- Individual field values can be accessed simply by using the field's API name, in the examples below we'll use the `address` field.
74
+ ### Fields Attribute
75
+ The `fields` attribute is a hashmap with the following structure:
76
+
77
+ * key: the API name of the field, as a `symbol`
78
+ * value: a `ListField` object which has a `values` attribute, containing a list of all values found for the field.
79
+
80
+ Individual field values can be accessed by using the field's API name, in the examples below we'll use the `address` field.
77
81
 
78
82
  ```ruby
79
83
  # raw data, list of each word object
80
- puts w9_data.document.address.values
84
+ pp result.inference.prediction.fields[:address].values
81
85
 
82
86
  # list of all values
83
- puts w9_data.document.address.contents_list
87
+ puts result.inference.prediction.fields[:address].contents_list
84
88
 
85
89
  # default string representation
86
- puts w9_data.document.address.to_s
90
+ puts result.inference.prediction.fields[:address].to_s
87
91
 
88
92
  # custom string representation
89
- puts w9_data.document.address.contents_str(separator: '_')
93
+ puts result.inference.prediction.fields[:address].contents_str(separator: '_')
90
94
  ```
91
95
 
92
- ### Fields property
93
- In addition to accessing a value field directly, it's possible to access it through the `fields` attribute.
94
- It's a hashmap with the following structure:
95
- * key: the API name of the field, as a `symbol`
96
- * value: a `ListField` object which has a `values` attribute, containing a list of all values found for the field.
97
-
98
- ```ruby
99
- # raw data, list of each word object
100
- puts w9_data.document.fields[:address].values
101
- ```
102
-
103
- This makes it simple to iterate over all the fields:
96
+ To iterate over all the fields:
104
97
  ```ruby
105
- w9_data.document.fields.each do |name, info|
98
+ result.inference.prediction.fields.each do |name, info|
106
99
  puts name
107
100
  puts info.values
108
101
  end
109
102
  ```
110
103
 
111
- ### Classifications property
112
- In addition to accessing a classification field directly, it's possible to access it through the `classifications` attribute.
113
- It's a hashmap with the following structure:
104
+ ### Classifications Attribute
105
+ The `classifications` attribute is a hashmap with the following structure:
106
+
114
107
  * key: the API name of the field, as a `symbol`
115
108
  * value: a `ClassificationField` object which has a `value` attribute, containing a string representation of the detected classification.
116
109
 
117
110
  ```ruby
118
111
  # raw data, list of each word object
119
- puts w9_data.document.classifications[:doc_type].value
112
+ puts result.document.classifications[:doc_type].value
120
113
  ```
121
114
 
122
- This makes it simple to iterate over all the fields:
115
+ To iterate over all the classifications:
123
116
  ```ruby
124
- w9_data.document.classifications.each do |name, info|
117
+ result.document.classifications.each do |name, info|
125
118
  puts name
126
119
  puts info.value
127
120
  end
@@ -45,7 +45,7 @@ cd mindee-api-ruby
45
45
  bundle install
46
46
  ```
47
47
 
48
- ## Updating the Library
48
+ ### Updating the Library
49
49
  It is important to always check the version of the Mindee OCR SDK you are using, as new and updated
50
50
  features won’t work on older versions.
51
51
 
@@ -64,7 +64,7 @@ gem install mindee@<version>
64
64
  ## Usage
65
65
  Using Mindee's APIs can be broken down into the following steps:
66
66
 
67
- 1. [Initialize a `Client`](#initializing-the-client)
67
+ 1. [Initialize a Client](#initializing-the-client)
68
68
  2. [Load a File](#loading-a-document-file)
69
69
  3. [Send the File](#sending-a-file) to Mindee's API
70
70
  4. [Process the Result](#process-the-result) in some way
@@ -19,7 +19,7 @@ puts result.inference.prediction
19
19
  ```
20
20
 
21
21
  Output:
22
- ```shell
22
+ ```
23
23
  :Locale: en; en; CAD;
24
24
  :Document type: INVOICE
25
25
  :Invoice number: 14
@@ -48,8 +48,10 @@ Code QTY Price Amount Tax (Rate) Descript
48
48
  ====================== ======== ========= ========== ================== ====================================
49
49
  ```
50
50
 
51
- **Note:** Line item descriptions are truncated here only for display purposes.
52
- The full text is available in the [details](#line-items).
51
+ > 📘 **Info**
52
+ >
53
+ > Line item descriptions are truncated here only for display purposes.
54
+ > The full text is available in the [details](#line-items).
53
55
 
54
56
  ## Fields
55
57
  Each prediction object contains a set of different fields.
@@ -91,11 +93,12 @@ puts result.inference.prediction.customer_name.value
91
93
  puts result.inference.prediction.customer_address.value
92
94
  ```
93
95
 
94
- **`customer_company_registration`** (Array<CompanyRegistration>): Customer's company registration
96
+ **`customer_company_registrations`** (Array<CompanyRegistration>): Customer's company registration
95
97
 
96
98
  ```ruby
97
99
  result.inference.prediction.customer_company_registrations.each do |registration|
98
- puts registration
100
+ puts registration.value
101
+ puts registration.type
99
102
  end
100
103
  ```
101
104
 
@@ -184,14 +187,10 @@ Each object in the list contains an extra attribute:
184
187
 
185
188
  * `type` (String): Type of company registration number among predefined categories.
186
189
  ```ruby
187
- # Show the type of the first registration
188
- puts result.inference.prediction.supplier_company_registrations[0].type
189
- ```
190
-
191
- * `value` (String): Value of the company identifier
192
- ```ruby
193
- # Show the value of the first registration
194
- puts result.inference.prediction.supplier_company_registrations[0].value
190
+ result.inference.prediction.supplier_company_registrations.each do |registration|
191
+ puts registration.value
192
+ puts registration.type
193
+ end
195
194
  ```
196
195
 
197
196
  ### Taxes
@@ -19,7 +19,7 @@ puts result.inference.prediction
19
19
  ```
20
20
 
21
21
  Output:
22
- ```shell
22
+ ```
23
23
  :Full name: HENERT PUDARSAN
24
24
  :Given names: HENERT
25
25
  :Surname: PUDARSAN
@@ -19,7 +19,7 @@ puts result.inference.prediction
19
19
  ```
20
20
 
21
21
  Output:
22
- ```shell
22
+ ```
23
23
  :Locale: en-US; en; US; USD;
24
24
  :Date: 2014-07-07
25
25
  :Category: food