@deepcitation/deepcitation-js 1.1.2 → 1.1.4
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.
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/react/utils.js +0 -1
- package/lib/types/index.d.ts +1 -1
- package/lib/types/index.js +1 -1
- package/lib/types/search.d.ts +7 -2
- package/lib/types/verification.d.ts +1 -1
- package/lib/types/verification.js +0 -4
- package/package.json +1 -1
package/lib/index.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ export { isGeminiGarbage, cleanRepeatingLastSentence, } from "./parsing/parseWor
|
|
|
10
10
|
export type { Citation, CitationStatus, VerifyCitationRequest, VerifyCitationResponse, OutputImageFormat, } from "./types/citation.js";
|
|
11
11
|
export { DEFAULT_OUTPUT_IMAGE_FORMAT } from "./types/citation.js";
|
|
12
12
|
export type { Verification } from "./types/verification.js";
|
|
13
|
-
export { NOT_FOUND_VERIFICATION_INDEX, PENDING_VERIFICATION_INDEX, BLANK_VERIFICATION,
|
|
13
|
+
export { NOT_FOUND_VERIFICATION_INDEX, PENDING_VERIFICATION_INDEX, BLANK_VERIFICATION, } from "./types/verification.js";
|
|
14
14
|
export type { SearchState, SearchStatus, SearchMethod, SearchAttempt, } from "./types/search.js";
|
|
15
15
|
export type { ScreenBox, PdfSpaceItem, IVertex } from "./types/boxes.js";
|
|
16
16
|
export { sha1Hash } from "./utils/sha.js";
|
package/lib/index.js
CHANGED
|
@@ -9,7 +9,7 @@ export { parseCitation, getCitationStatus, getAllCitationsFromLlmOutput, groupCi
|
|
|
9
9
|
export { normalizeCitations, getCitationPageNumber, } from "./parsing/normalizeCitation.js";
|
|
10
10
|
export { isGeminiGarbage, cleanRepeatingLastSentence, } from "./parsing/parseWorkAround.js";
|
|
11
11
|
export { DEFAULT_OUTPUT_IMAGE_FORMAT } from "./types/citation.js";
|
|
12
|
-
export { NOT_FOUND_VERIFICATION_INDEX, PENDING_VERIFICATION_INDEX, BLANK_VERIFICATION,
|
|
12
|
+
export { NOT_FOUND_VERIFICATION_INDEX, PENDING_VERIFICATION_INDEX, BLANK_VERIFICATION, } from "./types/verification.js";
|
|
13
13
|
// Utilities
|
|
14
14
|
export { sha1Hash } from "./utils/sha.js";
|
|
15
15
|
export { generateCitationKey } from "./react/utils.js";
|
package/lib/react/utils.js
CHANGED
|
@@ -9,7 +9,6 @@ export function generateCitationKey(citation) {
|
|
|
9
9
|
citation.pageNumber?.toString() || "",
|
|
10
10
|
citation.fullPhrase || "",
|
|
11
11
|
citation.keySpan?.toString() || "",
|
|
12
|
-
citation.value || "",
|
|
13
12
|
citation.lineIds?.join(",") || "",
|
|
14
13
|
citation.timestamps?.startTime || "",
|
|
15
14
|
citation.timestamps?.endTime || "",
|
package/lib/types/index.d.ts
CHANGED
|
@@ -6,6 +6,6 @@
|
|
|
6
6
|
export type { Citation, CitationStatus, VerifyCitationRequest, VerifyCitationResponse, OutputImageFormat, } from "./citation.js";
|
|
7
7
|
export { DEFAULT_OUTPUT_IMAGE_FORMAT } from "./citation.js";
|
|
8
8
|
export type { Verification } from "./verification.js";
|
|
9
|
-
export { NOT_FOUND_VERIFICATION_INDEX, PENDING_VERIFICATION_INDEX, BLANK_VERIFICATION,
|
|
9
|
+
export { NOT_FOUND_VERIFICATION_INDEX, PENDING_VERIFICATION_INDEX, BLANK_VERIFICATION, } from "./verification.js";
|
|
10
10
|
export type { SearchState, SearchStatus } from "./search.js";
|
|
11
11
|
export type { ScreenBox, PdfSpaceItem, IVertex } from "./boxes.js";
|
package/lib/types/index.js
CHANGED
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
* @packageDocumentation
|
|
5
5
|
*/
|
|
6
6
|
export { DEFAULT_OUTPUT_IMAGE_FORMAT } from "./citation.js";
|
|
7
|
-
export { NOT_FOUND_VERIFICATION_INDEX, PENDING_VERIFICATION_INDEX, BLANK_VERIFICATION,
|
|
7
|
+
export { NOT_FOUND_VERIFICATION_INDEX, PENDING_VERIFICATION_INDEX, BLANK_VERIFICATION, } from "./verification.js";
|
package/lib/types/search.d.ts
CHANGED
|
@@ -1,16 +1,21 @@
|
|
|
1
1
|
export type SearchStatus = "loading" | "pending" | "not_found" | "partial_text_found" | "found" | "found_value_only" | "found_phrase_missed_value" | "found_on_other_page" | "found_on_other_line" | "first_word_found" | "timestamp_wip";
|
|
2
|
-
export type SearchMethod = "exact_line_match" | "line_with_buffer" | "current_page" | "adjacent_pages" | "expanded_window" | "regex_search" | "bm25_search" | "fuzzy_regex" | "first_word_fallback";
|
|
2
|
+
export type SearchMethod = "exact_line_match" | "line_with_buffer" | "current_page" | "keyspan_fallback" | "adjacent_pages" | "expanded_window" | "regex_search" | "bm25_search" | "fuzzy_regex" | "first_word_fallback";
|
|
3
3
|
export interface SearchAttempt {
|
|
4
4
|
method: SearchMethod;
|
|
5
5
|
success: boolean;
|
|
6
6
|
searchPhrases: string[];
|
|
7
7
|
pageSearched?: number;
|
|
8
|
+
matchedPhrases?: string[];
|
|
9
|
+
matchedVariation?: string;
|
|
10
|
+
phraseVariations?: string[];
|
|
11
|
+
matchQuality?: string;
|
|
12
|
+
isPartialMatch?: boolean;
|
|
8
13
|
matchScore?: number;
|
|
9
14
|
matchSnippet?: string;
|
|
10
15
|
notes?: string;
|
|
11
|
-
durationMs?: number;
|
|
12
16
|
startTime?: number;
|
|
13
17
|
endTime?: number;
|
|
18
|
+
durationMs?: number;
|
|
14
19
|
}
|
|
15
20
|
export interface SearchState {
|
|
16
21
|
status: SearchStatus;
|
|
@@ -4,7 +4,6 @@ import { type PdfSpaceItem } from "./boxes.js";
|
|
|
4
4
|
export declare const NOT_FOUND_VERIFICATION_INDEX = -1;
|
|
5
5
|
export declare const PENDING_VERIFICATION_INDEX = -2;
|
|
6
6
|
export declare const BLANK_VERIFICATION: Verification;
|
|
7
|
-
export declare function deterministicIdFromVerification(verification: Verification): string;
|
|
8
7
|
export interface Verification {
|
|
9
8
|
regex?: RegExp | null;
|
|
10
9
|
lowerCaseSearchTerm: string | null;
|
|
@@ -15,6 +14,7 @@ export interface Verification {
|
|
|
15
14
|
citation?: Citation;
|
|
16
15
|
searchState?: SearchState | null;
|
|
17
16
|
hitIndexWithinPage?: number | null;
|
|
17
|
+
highlightColor?: string | null;
|
|
18
18
|
matchSnippet?: string | null;
|
|
19
19
|
pdfSpaceItem?: PdfSpaceItem;
|
|
20
20
|
verificationImageBase64?: string | null;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { sha1Hash } from "../utils/sha.js";
|
|
2
1
|
export const NOT_FOUND_VERIFICATION_INDEX = -1;
|
|
3
2
|
export const PENDING_VERIFICATION_INDEX = -2;
|
|
4
3
|
export const BLANK_VERIFICATION = {
|
|
@@ -18,6 +17,3 @@ export const BLANK_VERIFICATION = {
|
|
|
18
17
|
pageNumber: NOT_FOUND_VERIFICATION_INDEX,
|
|
19
18
|
},
|
|
20
19
|
};
|
|
21
|
-
export function deterministicIdFromVerification(verification) {
|
|
22
|
-
return sha1Hash(`${verification.lowerCaseSearchTerm}-${verification.attachmentId}-${verification.pageNumber}-${verification.hitIndexWithinPage}-${verification.matchSnippet}-${verification?.hitIndexWithinPage}`);
|
|
23
|
-
}
|