extract-cite 1.0.0 → 1.0.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.
package/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  Cite any webpage. Two passes:
4
4
 
5
5
  1. **`extractCite`**: reads author, date, title and source straight off the HTML (meta tags, bylines, JSON-LD, URL patterns, a 92k-name database that tells people from organizations). Instant, offline, partial.
6
- 2. **`extractCiteLLM`**: one model call (OpenRouter by default) that is given the partial citation and the parts still missing, completes the full APA citation, **scores the confidence of every part**, **flags parts for review**, and reads **author qualifications** from the page's bio. Output in APA 7, MLA 9, Chicago, Harvard, IEEE and BibTeX.
6
+ 2. **`extractCiteLLM`**: one model call (OpenRouter by default) that is given the partial citation and the parts still missing, completes the full APA citation, **scores the confidence of every part**, **flags parts for review**, and reads **author qualifications** from the page's bio. Output in APA 7, MLA 9, Chicago, Harvard, IEEE and BibTeX. The same call **checks the content**: is the extracted text the full article or a paywall stub, and which header, nav, sidebar and footer blocks to cut for readability.
7
7
 
8
8
  ```bash
9
9
  bun add extract-cite
@@ -24,6 +24,8 @@ cite.formatted.mla?.html; // with <i> italics, HTML-escaped
24
24
  cite.confidence; // { title: 0.98, publishedDate: 0.95, … }
25
25
  cite.needsReview; // [{ field, confidence, reason }]
26
26
  cite.citation.authors[0].qualifications; // { jobTitle, affiliation, credentials, evidence, … }
27
+ cite.contentCheck?.verdict; // "full" | "paywalled" | "truncated" | "blocked" | "not-article" | "unknown"
28
+ cite.contentCheck?.tips; // [{ region: "sidebar", selector: "aside.sidebar", example, tip }]
27
29
  ```
28
30
 
29
31
  | Option | Default | |
@@ -35,13 +37,20 @@ cite.citation.authors[0].qualifications; // { jobTitle, affiliation, credentia
35
37
  | `styles` | all | `apa`, `mla`, `chicago`, `harvard`, `ieee`, `bibtex` |
36
38
  | `reviewThreshold` | `0.7` | Parts below this go in `needsReview`. |
37
39
  | `maxChars` | `12000` | Page text sent to the model (head and tail). |
40
+ | `content` | page text | The article you extracted (HTML or text, e.g. extract-webpage's `html`), for the content check. |
41
+ | `checkContent` | `true` | Run the content check in the same call. |
42
+ | `contentWords` | `3000` | Words of content the check reads, from the start. |
38
43
  | `fetch` | global | Replaces `fetch` for both the page and the model call. |
39
44
 
45
+ ### Content check
46
+
47
+ The model reads the first `contentWords` words of `content` and an outline of the page's blocks (`header.site-header (6 words) "Example Ledger Sign in…"`) and returns `contentCheck`: a `verdict`, the `signals` that show it ("Subscribe to continue reading"), a `note` for the reader, the `contentSelector` that holds the article body, and `tips` for the clutter the content still holds (header, nav, sidebar, footer, ads, related, newsletter, share, comments, cookie banner). `selectors` is the same as `{ content, remove }`, the shape of an entry in extract-webpage's `extract-selectors-per-domain.json`. A verdict other than `full` also lands in `needsReview` as `field: "content"`.
48
+
40
49
  `formatCitation(citation, style)` and `formatCitations(citation, styles)` re-style a result offline.
41
50
 
42
51
  ## What it will not do
43
52
 
44
- The model's reply is not trusted. Text is fenced as untrusted data; strings are stripped of markup; dates must be real; an author whose name the page never prints is capped at 0.2 confidence and flagged; author qualifications need a verbatim quote that is on the page, or they are dropped. A part the page does not state comes back empty and flagged, not guessed. Still: **check `needsReview` before you cite**.
53
+ The model's reply is not trusted. Text is fenced as untrusted data; strings are stripped of markup; dates must be real; an author whose name the page never prints is capped at 0.2 confidence and flagged; author qualifications need a verbatim quote that is on the page, or they are dropped. A part the page does not state comes back empty and flagged, not guessed. Content-check signals and examples must be in the text, and its selectors must match an element on the page, or they are dropped. Still: **check `needsReview` before you cite**.
45
54
 
46
55
  ## Moved from extract-webpage
47
56