Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,4 +149,4 @@ Available as open source under the terms of the [MIT License](https://opensource


## Questions?
[Join our Slack](https://join.slack.com/t/mindee-community/shared_invite/zt-1jv6nawjq-FDgFcF2T5CmMmRpl9LLptw)
[Join our Slack](https://join.slack.com/t/mindee-community/shared_invite/zt-2d0ds7dtz-DPAF81ZqTy20chsYpQBW5g)
41 changes: 41 additions & 0 deletions docs/code_samples/eu_driver_license_v1.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import com.mindee.MindeeClient;
import com.mindee.input.LocalInputSource;
import com.mindee.parsing.common.PredictResponse;
import com.mindee.product.eu.driverlicense.DriverLicenseV1;
import java.io.File;
import java.io.IOException;

public class SimpleMindeeClient {

public static void main(String[] args) throws IOException {
String apiKey = "my-api-key";
String filePath = "/path/to/the/file.ext";

// Init a new client
MindeeClient mindeeClient = new MindeeClient(apiKey);

// Load a file from disk
LocalInputSource inputSource = new LocalInputSource(filePath);

// Parse the file
PredictResponse<DriverLicenseV1> response = mindeeClient.parse(
DriverLicenseV1.class,
inputSource
);

// Print a summary of the response
System.out.println(response.toString());

// Print a summary of the predictions
// System.out.println(response.getDocument().toString());

// Print the document-level predictions
// System.out.println(response.getDocument().getInference().getPrediction().toString());

// Print the page-level predictions
// response.getDocument().getInference().getPages().forEach(
// page -> System.out.println(page.toString())
// );
}

}
41 changes: 41 additions & 0 deletions docs/code_samples/international_id_v2_async.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import com.mindee.MindeeClient;
import com.mindee.input.LocalInputSource;
import com.mindee.parsing.common.AsyncPredictResponse;
import com.mindee.product.internationalid.InternationalIdV2;
import java.io.File;
import java.io.IOException;

public class SimpleMindeeClient {

public static void main(String[] args) throws IOException, InterruptedException {
String apiKey = "my-api-key";
String filePath = "/path/to/the/file.ext";

// Init a new client
MindeeClient mindeeClient = new MindeeClient(apiKey);

// Load a file from disk
LocalInputSource inputSource = new LocalInputSource(new File(filePath));

// Parse the file asynchronously
AsyncPredictResponse<InternationalIdV2> response = mindeeClient.enqueueAndParse(
InternationalIdV2.class,
inputSource
);

// Print a summary of the response
System.out.println(response.toString());

// Print a summary of the predictions
// System.out.println(response.getDocumentObj().toString());

// Print the document-level predictions
// System.out.println(response.getDocumentObj().getInference().getPrediction().toString());

// Print the page-level predictions
// response.getDocumentObj().getInference().getPages().forEach(
// page -> System.out.println(page.toString())
// );
}

}
41 changes: 41 additions & 0 deletions docs/code_samples/resume_v1_async.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import com.mindee.MindeeClient;
import com.mindee.input.LocalInputSource;
import com.mindee.parsing.common.AsyncPredictResponse;
import com.mindee.product.resume.ResumeV1;
import java.io.File;
import java.io.IOException;

public class SimpleMindeeClient {

public static void main(String[] args) throws IOException, InterruptedException {
String apiKey = "my-api-key";
String filePath = "/path/to/the/file.ext";

// Init a new client
MindeeClient mindeeClient = new MindeeClient(apiKey);

// Load a file from disk
LocalInputSource inputSource = new LocalInputSource(new File(filePath));

// Parse the file asynchronously
AsyncPredictResponse<ResumeV1> response = mindeeClient.enqueueAndParse(
ResumeV1.class,
inputSource
);

// Print a summary of the response
System.out.println(response.toString());

// Print a summary of the predictions
// System.out.println(response.getDocumentObj().toString());

// Print the document-level predictions
// System.out.println(response.getDocumentObj().getInference().getPrediction().toString());

// Print the page-level predictions
// response.getDocumentObj().getInference().getPages().forEach(
// page -> System.out.println(page.toString())
// );
}

}
2 changes: 1 addition & 1 deletion docs/java-api-builder.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,4 +130,4 @@ for (Page<CustomV1Page> page : inference.getPages()) {
```

## Questions?
[Join our Slack](https://join.slack.com/t/mindee-community/shared_invite/zt-1jv6nawjq-FDgFcF2T5CmMmRpl9LLptw)
[Join our Slack](https://join.slack.com/t/mindee-community/shared_invite/zt-2d0ds7dtz-DPAF81ZqTy20chsYpQBW5g)
2 changes: 1 addition & 1 deletion docs/java-field.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 +77,4 @@ This field type captures tax information
The `value` attribute is of type `java.time.LocalTime`

## Questions?
[Join our Slack](https://join.slack.com/t/mindee-community/shared_invite/zt-1jv6nawjq-FDgFcF2T5CmMmRpl9LLptw)
[Join our Slack](https://join.slack.com/t/mindee-community/shared_invite/zt-2d0ds7dtz-DPAF81ZqTy20chsYpQBW5g)
2 changes: 1 addition & 1 deletion docs/java-financial-document-ocr.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,4 @@ Code QTY Price Amount Tax (Rate) Descript
```

## Questions?
[Join our Slack](https://join.slack.com/t/mindee-community/shared_invite/zt-1jv6nawjq-FDgFcF2T5CmMmRpl9LLptw)
[Join our Slack](https://join.slack.com/t/mindee-community/shared_invite/zt-2d0ds7dtz-DPAF81ZqTy20chsYpQBW5g)
2 changes: 1 addition & 1 deletion docs/java-getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -293,4 +293,4 @@ Each page element contains the data extracted for a particular page of the docum


## Questions?
[Join our Slack](https://join.slack.com/t/mindee-community/shared_invite/zt-1jv6nawjq-FDgFcF2T5CmMmRpl9LLptw)
[Join our Slack](https://join.slack.com/t/mindee-community/shared_invite/zt-2d0ds7dtz-DPAF81ZqTy20chsYpQBW5g)
2 changes: 1 addition & 1 deletion docs/java-invoice-ocr.md
Original file line number Diff line number Diff line change
Expand Up @@ -291,4 +291,4 @@ logger.info(invoiceDocument.getInference().getDocumentPrediction().getTotalNet()
````

## Questions?
[Join our Slack](https://join.slack.com/t/mindee-community/shared_invite/zt-1jv6nawjq-FDgFcF2T5CmMmRpl9LLptw)
[Join our Slack](https://join.slack.com/t/mindee-community/shared_invite/zt-2d0ds7dtz-DPAF81ZqTy20chsYpQBW5g)
2 changes: 1 addition & 1 deletion docs/java-license-plates-ocr.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,4 @@ Page 0
```

## Questions?
[Join our Slack](https://join.slack.com/t/mindee-community/shared_invite/zt-1jv6nawjq-FDgFcF2T5CmMmRpl9LLptw)
[Join our Slack](https://join.slack.com/t/mindee-community/shared_invite/zt-2d0ds7dtz-DPAF81ZqTy20chsYpQBW5g)
2 changes: 1 addition & 1 deletion docs/java-passport-ocr.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,4 +134,4 @@ The following date fields are available:
* **`surname`** (StringField): Passport's owner surname.

## Questions?
[Join our Slack](https://join.slack.com/t/mindee-community/shared_invite/zt-1jv6nawjq-FDgFcF2T5CmMmRpl9LLptw)
[Join our Slack](https://join.slack.com/t/mindee-community/shared_invite/zt-2d0ds7dtz-DPAF81ZqTy20chsYpQBW5g)
2 changes: 1 addition & 1 deletion docs/java-proof-of-address-ocr.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,4 @@ Output:
```

## Questions?
[Join our Slack](https://join.slack.com/t/mindee-community/shared_invite/zt-1jv6nawjq-FDgFcF2T5CmMmRpl9LLptw)
[Join our Slack](https://join.slack.com/t/mindee-community/shared_invite/zt-2d0ds7dtz-DPAF81ZqTy20chsYpQBW5g)
2 changes: 1 addition & 1 deletion docs/java-receipt-ocr.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,4 +148,4 @@ The following date fields are available:


## Questions?
[Join our Slack](https://join.slack.com/t/mindee-community/shared_invite/zt-1jv6nawjq-FDgFcF2T5CmMmRpl9LLptw)
[Join our Slack](https://join.slack.com/t/mindee-community/shared_invite/zt-2d0ds7dtz-DPAF81ZqTy20chsYpQBW5g)
2 changes: 1 addition & 1 deletion docs/java-us-bank-check-ocr.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,4 @@ Page 0
```

## Questions?
[Join our Slack](https://join.slack.com/t/mindee-community/shared_invite/zt-1jv6nawjq-FDgFcF2T5CmMmRpl9LLptw)
[Join our Slack](https://join.slack.com/t/mindee-community/shared_invite/zt-2d0ds7dtz-DPAF81ZqTy20chsYpQBW5g)
17 changes: 17 additions & 0 deletions src/main/java/com/mindee/parsing/SummaryHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,23 @@ public static <T extends LineItemField> String arrayToString(List<T> lineItems,
);
}

/**
* Truncates a string if it's too long for the requested width.
*/
public static String formatForDisplay(String inputString, Integer maxColSize) {
if (inputString == null || inputString.isEmpty()) {
return "";
}
if (maxColSize == null) {
return inputString;
}
if (inputString.length() <= maxColSize) {
return inputString;
} else {
return inputString.substring(0, maxColSize - 3) + "...";
}
}

/**
* Format an rST table line separator.
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package com.mindee.product.cropper;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.mindee.parsing.SummaryHelper;
import com.mindee.parsing.common.Prediction;
import lombok.EqualsAndHashCode;
import lombok.Getter;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package com.mindee.product.eu.driverlicense;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.mindee.http.EndpointInfo;
import com.mindee.parsing.common.Inference;
import lombok.Getter;

/**
* The definition for Driver License, API version 1.
*/
@Getter
@JsonIgnoreProperties(ignoreUnknown = true)
@EndpointInfo(endpointName = "eu_driver_license", version = "1")
public class DriverLicenseV1
extends Inference<DriverLicenseV1Page, DriverLicenseV1Document> {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
package com.mindee.product.eu.driverlicense;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.mindee.parsing.SummaryHelper;
import com.mindee.parsing.common.Prediction;
import com.mindee.parsing.standard.DateField;
import com.mindee.parsing.standard.StringField;
import lombok.EqualsAndHashCode;
import lombok.Getter;

/**
* Document data for Driver License, API version 1.
*/
@Getter
@EqualsAndHashCode(callSuper = false)
@JsonIgnoreProperties(ignoreUnknown = true)
public class DriverLicenseV1Document extends Prediction {

/**
* EU driver license holders address
*/
@JsonProperty("address")
private StringField address;
/**
* EU driver license holders categories
*/
@JsonProperty("category")
private StringField category;
/**
* Country code extracted as a string.
*/
@JsonProperty("country_code")
private StringField countryCode;
/**
* The date of birth of the document holder
*/
@JsonProperty("date_of_birth")
private DateField dateOfBirth;
/**
* ID number of the Document.
*/
@JsonProperty("document_id")
private StringField documentId;
/**
* Date the document expires
*/
@JsonProperty("expiry_date")
private DateField expiryDate;
/**
* First name(s) of the driver license holder
*/
@JsonProperty("first_name")
private StringField firstName;
/**
* Authority that issued the document
*/
@JsonProperty("issue_authority")
private StringField issueAuthority;
/**
* Date the document was issued
*/
@JsonProperty("issue_date")
private DateField issueDate;
/**
* Last name of the driver license holder.
*/
@JsonProperty("last_name")
private StringField lastName;
/**
* Machine-readable license number
*/
@JsonProperty("mrz")
private StringField mrz;
/**
* Place where the driver license holder was born
*/
@JsonProperty("place_of_birth")
private StringField placeOfBirth;

@Override
public boolean isEmpty() {
return (
this.countryCode == null
&& this.documentId == null
&& this.category == null
&& this.lastName == null
&& this.firstName == null
&& this.dateOfBirth == null
&& this.placeOfBirth == null
&& this.expiryDate == null
&& this.issueDate == null
&& this.issueAuthority == null
&& this.mrz == null
&& this.address == null
);
}

@Override
public String toString() {
StringBuilder outStr = new StringBuilder();
outStr.append(
String.format(":Country Code: %s%n", this.getCountryCode())
);
outStr.append(
String.format(":Document ID: %s%n", this.getDocumentId())
);
outStr.append(
String.format(":Driver License Category: %s%n", this.getCategory())
);
outStr.append(
String.format(":Last Name: %s%n", this.getLastName())
);
outStr.append(
String.format(":First Name: %s%n", this.getFirstName())
);
outStr.append(
String.format(":Date Of Birth: %s%n", this.getDateOfBirth())
);
outStr.append(
String.format(":Place Of Birth: %s%n", this.getPlaceOfBirth())
);
outStr.append(
String.format(":Expiry Date: %s%n", this.getExpiryDate())
);
outStr.append(
String.format(":Issue Date: %s%n", this.getIssueDate())
);
outStr.append(
String.format(":Issue Authority: %s%n", this.getIssueAuthority())
);
outStr.append(
String.format(":MRZ: %s%n", this.getMrz())
);
outStr.append(
String.format(":Address: %s%n", this.getAddress())
);
return SummaryHelper.cleanSummary(outStr.toString());
}
}
Loading