extract-cite 1.0.5 → 1.0.7
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 +16 -1
- package/dist/extract-cite-full.cjs.js +2 -0
- package/dist/extract-cite-full.cjs.js.map +1 -0
- package/dist/extract-cite-full.d.ts +2 -0
- package/dist/extract-cite-full.es.js +2 -0
- package/dist/extract-cite-full.es.js.map +1 -0
- package/dist/extract-cite-src.cjs.js +2 -0
- package/dist/extract-cite-src.cjs.js.map +1 -0
- package/dist/extract-cite-src.es.js +4 -0
- package/dist/extract-cite-src.es.js.map +1 -0
- package/dist/extract-cite.cjs.js +1 -2
- package/dist/extract-cite.d.ts +2 -0
- package/dist/extract-cite.es.js +1 -4
- package/dist/full.d.ts +1 -0
- package/dist/html-to-cite/human-names-db.d.ts +32 -0
- package/dist/index.d.ts +5 -2
- package/package.json +6 -1
- package/src/full.ts +12 -0
- package/src/html-to-cite/human-names-db.ts +74 -0
- package/src/html-to-cite/human-names-recognize.ts +13 -8
- package/src/index.ts +5 -2
- package/dist/extract-cite.cjs.js.map +0 -1
- package/dist/extract-cite.es.js.map +0 -1
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Cite any webpage. Two passes:
|
|
4
4
|
|
|
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.
|
|
5
|
+
1. **`extractCite`**: reads author, date, title and source straight off the HTML (meta tags, bylines, JSON-LD, URL patterns, and optionally a 92k-name database that tells people from organizations). Instant, offline, partial.
|
|
6
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
|
|
@@ -42,6 +42,21 @@ cite.contentCheck?.tips; // [{ region: "sidebar", selector: "a
|
|
|
42
42
|
| `contentWords` | `3000` | Words of content the check reads, from the start. |
|
|
43
43
|
| `fetch` | global | Replaces `fetch` for both the page and the model call. |
|
|
44
44
|
|
|
45
|
+
### Slim default vs. `extract-cite/full`
|
|
46
|
+
|
|
47
|
+
The default entry is slim (~60 kB): it does **not** bundle the 92k human-names JSON (~1 MB), so person-vs-organization detection uses word heuristics only. To get the names database:
|
|
48
|
+
|
|
49
|
+
```ts
|
|
50
|
+
// Lazy-load it from the jsDelivr CDN (shared, cached; resolves null on failure)
|
|
51
|
+
import { extractCite, loadHumanNamesDB } from "extract-cite";
|
|
52
|
+
await loadHumanNamesDB(); // or { url, fetch } to self-host
|
|
53
|
+
|
|
54
|
+
// Or bundle it: same API, names database registered on import
|
|
55
|
+
import { extractCite } from "extract-cite/full";
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
`setHumanNamesDB(db)` registers a copy you already hold. Both entries share one database, so importing `extract-cite/full` once enables it for the slim import too.
|
|
59
|
+
|
|
45
60
|
### Content check
|
|
46
61
|
|
|
47
62
|
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"`.
|