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
1 change: 0 additions & 1 deletion src/parsing/v2/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ export { ErrorResponse } from "./errorResponse";
export { Inference } from "./inference";
export { InferenceFile } from "./inferenceFile";
export { InferenceModel } from "./inferenceModel";
export { InferenceResultOptions } from "./inferenceResultOptions";
export { InferenceResponse } from "./inferenceResponse";
export { InferenceResult } from "./inferenceResult";
export { Job } from "./job";
Expand Down
17 changes: 3 additions & 14 deletions src/parsing/v2/inferenceResult.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { InferenceFields } from "./field/inferenceFields";
import { InferenceResultOptions } from "./inferenceResultOptions";
import { InferenceFields } from "./field";
import { StringDict } from "../common";
import { RawText } from "./rawText";

Expand All @@ -8,12 +7,11 @@ export class InferenceResult {
* Fields contained in the inference.
*/
public fields: InferenceFields;
public rawText?: RawText;

/**
* Potential options retrieved alongside the inference.
* Raw text extracted from all pages.
*/
public options?: InferenceResultOptions;
public rawText?: RawText;

constructor(serverResponse: StringDict) {
this.fields = new InferenceFields(serverResponse["fields"]);
Expand All @@ -28,15 +26,6 @@ export class InferenceResult {
"======",
this.fields.toString(),
];

if (this.options) {
parts.push(
"Options",
"=======",
this.options.toString()
);
}

return parts.join("\n");
}
}
15 changes: 0 additions & 15 deletions src/parsing/v2/inferenceResultOptions.ts

This file was deleted.

3 changes: 3 additions & 0 deletions src/parsing/v2/rawText.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ import { StringDict } from "../common";
import { RawTextPage } from "./rawTextPage";

export class RawText {
/**
* List of pages with their extracted text content.
*/
pages: Array<RawTextPage>;

constructor(serverResponse: StringDict) {
Expand Down
2 changes: 1 addition & 1 deletion tests/parsing/v2/inference.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ describe("inference", async () => {
const cityField = customerAddr.fields.getSimpleField("city");
expect(cityField.value).to.eq("New York");

expect(inference.result.options).to.be.undefined;
expect(inference.result.rawText).to.be.undefined;
});
});

Expand Down
23 changes: 13 additions & 10 deletions tests/v2/clientV2.integration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,14 @@ describe("MindeeClientV2 – integration tests (V2)", () => {
const response = await client.enqueueAndGetInference(source, params);

expect(response).to.exist;
const inf = response.inference;
expect(inf).to.exist;
const inference = response.inference;
expect(inference).to.exist;

expect(inf.file?.name).to.equal("multipage_cut-2.pdf");
expect(inf.model?.id).to.equal(modelId);
expect(inference.file?.name).to.equal("multipage_cut-2.pdf");
expect(inference.model?.id).to.equal(modelId);

expect(inf.result).to.exist;
expect(inf.result.options).to.be.undefined;
expect(inference.result).to.exist;
expect(inference.result.rawText).to.be.undefined;
}).timeout(60000);

it("Filled, single-page image – enqueue & parse must succeed", async () => {
Expand All @@ -53,11 +53,14 @@ describe("MindeeClientV2 – integration tests (V2)", () => {

const response = await client.enqueueAndGetInference(source, params);

const inf = response.inference;
expect(inf.file?.name).to.equal("default_sample.jpg");
expect(inf.model?.id).to.equal(modelId);
const inference = response.inference;
expect(inference.file?.name).to.equal("default_sample.jpg");
expect(inference.model?.id).to.equal(modelId);

const supplierField = inf.result.fields.get("supplier_name") as SimpleField;
expect(inference.result).to.exist;
expect(inference.result.rawText).to.be.undefined;

const supplierField = inference.result.fields.get("supplier_name") as SimpleField;
expect(supplierField).to.be.instanceOf(SimpleField);
expect(supplierField.value).to.equal("John Smith");
}).timeout(60000);
Expand Down
Loading