veriquote 0.2.1 → 0.3.0

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 (43) hide show
  1. package/CITATION.cff +2 -2
  2. package/README.md +102 -51
  3. package/dist/cli/main.d.ts.map +1 -1
  4. package/dist/cli/main.js +42 -5
  5. package/dist/cli/main.js.map +1 -1
  6. package/dist/gate.d.ts +13 -3
  7. package/dist/gate.d.ts.map +1 -1
  8. package/dist/gate.js +20 -2
  9. package/dist/gate.js.map +1 -1
  10. package/dist/index.d.ts +1 -1
  11. package/dist/index.d.ts.map +1 -1
  12. package/dist/index.js +1 -1
  13. package/dist/index.js.map +1 -1
  14. package/dist/match/fuzzy.d.ts +10 -2
  15. package/dist/match/fuzzy.d.ts.map +1 -1
  16. package/dist/match/fuzzy.js +87 -11
  17. package/dist/match/fuzzy.js.map +1 -1
  18. package/dist/protocol/evi1.d.ts +21 -1
  19. package/dist/protocol/evi1.d.ts.map +1 -1
  20. package/dist/protocol/evi1.js +169 -28
  21. package/dist/protocol/evi1.js.map +1 -1
  22. package/dist/protocol/prompt.d.ts +6 -0
  23. package/dist/protocol/prompt.d.ts.map +1 -1
  24. package/dist/protocol/prompt.js +35 -10
  25. package/dist/protocol/prompt.js.map +1 -1
  26. package/dist/report.d.ts.map +1 -1
  27. package/dist/report.js +52 -15
  28. package/dist/report.js.map +1 -1
  29. package/dist/source/html.d.ts.map +1 -1
  30. package/dist/source/html.js +3 -0
  31. package/dist/source/html.js.map +1 -1
  32. package/dist/types.d.ts +23 -2
  33. package/dist/types.d.ts.map +1 -1
  34. package/package.json +3 -3
  35. package/src/cli/main.ts +41 -6
  36. package/src/gate.ts +30 -5
  37. package/src/index.ts +1 -0
  38. package/src/match/fuzzy.ts +98 -11
  39. package/src/protocol/evi1.ts +174 -29
  40. package/src/protocol/prompt.ts +42 -9
  41. package/src/report.ts +53 -21
  42. package/src/source/html.ts +3 -0
  43. package/src/types.ts +20 -2
package/src/types.ts CHANGED
@@ -57,6 +57,13 @@ export type MatchMethod =
57
57
  | 'exact'
58
58
  /** Substring after Unicode/typography normalization and case folding. */
59
59
  | 'normalized'
60
+ /**
61
+ * The quote omits text, marked with an ellipsis ("…", "...", "[…]"): every
62
+ * fragment occurs literally, in order and close together. `start`/`end`
63
+ * cover the whole passage, omitted text included, and that passage is what
64
+ * the judge sees.
65
+ */
66
+ | 'elided'
60
67
  /** Best fuzzy window by character-trigram Dice similarity. */
61
68
  | 'fuzzy'
62
69
  /** No window reached the fuzzy score threshold. */
@@ -66,8 +73,9 @@ export type MatchMethod =
66
73
  export interface QuoteMatch {
67
74
  method: MatchMethod;
68
75
  /**
69
- * Similarity in [0, 1]. `1` only for exact/normalized hits; fuzzy scores
70
- * are capped at 0.99 so a perfect score always implies a literal hit.
76
+ * Similarity in [0, 1]. `1` only for exact/normalized hits; elided and
77
+ * fuzzy scores are capped at 0.99 so a perfect score always implies a
78
+ * literal hit.
71
79
  */
72
80
  score: number;
73
81
  /** Start offset of the matched region in the original source field, if known. */
@@ -76,6 +84,12 @@ export interface QuoteMatch {
76
84
  end?: number;
77
85
  /** Which source field matched: `"text"` or `"extraTexts[i]"`. */
78
86
  field: string;
87
+ /**
88
+ * `elided` only: words in the omitted text that can reverse or limit a
89
+ * statement ("not", "except", "only", "however", …). A hint, not a verdict:
90
+ * the judge sees the full passage and decides.
91
+ */
92
+ omittedCues?: string[];
79
93
  }
80
94
 
81
95
  /** Qualitative entailment classes produced by the LLM judge. */
@@ -122,8 +136,12 @@ export interface CitationVerification {
122
136
  claimId: string;
123
137
  sourceIndex: number;
124
138
  claimText: string;
139
+ /** The quote; several quotes for the same (claim, source) pair are joined with " […] ". */
125
140
  quote: string;
141
+ /** The match of the quote; with several quotes, the weakest one (cues of all of them). */
126
142
  textMatch: QuoteMatch;
143
+ /** One entry per quote, present only when the pair has more than one. */
144
+ parts?: { quote: string; textMatch: QuoteMatch }[];
127
145
  /** Absent when verification ran without a judge. */
128
146
  entailment?: EntailmentResult;
129
147
  /**