synset 0.9.0 → 0.9.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
@@ -1,19 +1,47 @@
1
+ [![npm version](https://img.shields.io/npm/v/synset.svg)](https://www.npmjs.com/package/synset)
2
+
1
3
  # synset
2
4
 
3
5
  WordNet dictionary parser with Zod validation, query utilities, and CLI.
4
6
 
5
- ## Install
7
+ ## Usage
8
+
9
+ ### CLI
6
10
 
7
11
  ```bash
8
- npm install synset
9
- # or
10
- bun add synset
12
+ # Run without installing
13
+ bunx synset define dog
14
+
15
+ # List synonyms
16
+ bunx synset synonyms happy
17
+
18
+ # Show hypernyms (more general terms)
19
+ bunx synset hypernyms dog
20
+
21
+ # Show all relations
22
+ bunx synset related computer
23
+
24
+ # Pre-download WordNet data
25
+ bunx synset fetch
26
+
27
+ # Use local file instead of cache
28
+ bunx synset define dog --file ./path/to/english-wordnet-{YEAR}.xml
11
29
  ```
12
30
 
13
- ## Usage
31
+ > Or install globally:
32
+ > ```bash
33
+ > bun install -g synset
34
+ > synset define dog
35
+ > ```
14
36
 
15
37
  ### Library
16
38
 
39
+ ```bash
40
+ npm install synset
41
+ # or
42
+ bun add synset
43
+ ```
44
+
17
45
  ```ts
18
46
  import {
19
47
  fetchWordNet,
@@ -32,9 +60,6 @@ console.log(`Loaded WordNet ${version}`)
32
60
  // Or load from local file
33
61
  const lexicon = await loadWordNet('./path/to/english-wordnet-{YEAR}.xml')
34
62
 
35
- // Or request specific version
36
- const { lexicon } = await fetchWordNet({ version: '2024' })
37
-
38
63
  // Build index for fast lookups
39
64
  const index = buildIndex(lexicon)
40
65
 
@@ -52,45 +77,10 @@ findSynsets(index, 'bank')
52
77
  // [Synset for "financial institution", Synset for "river bank", ...]
53
78
  ```
54
79
 
55
- ### CLI
56
-
57
- ```bash
58
- # Show definitions
59
- synset define dog
60
-
61
- # List synonyms
62
- synset synonyms happy
63
-
64
- # Show hypernyms (more general terms)
65
- synset hypernyms dog
66
-
67
- # Show all relations
68
- synset related computer
69
-
70
- # Pre-download WordNet data
71
- synset fetch
72
-
73
- # Use local file instead of cache
74
- synset define dog --file ./path/to/english-wordnet-{YEAR}.xml
75
- ```
76
-
77
- ### Exports
78
-
79
- ```ts
80
- // Zod schemas (runtime validation)
81
- import { Lexicon, Synset, Sense, LexicalEntry } from 'synset'
82
-
83
- // TypeScript types
84
- import type { LexiconType, SynsetType, SenseType } from 'synset'
85
-
86
- // Human-readable labels
87
- import { PartsOfSpeechLabels, SynsetRelationLabels } from 'synset'
88
- ```
89
-
90
80
  ## Runtime
91
81
 
92
82
  - **Bun**: Full support (recommended)
93
- - **Node.js 18+**: Supported for remote fetching. Local file parsing requires Bun due to `file://` URL fetch limitations.
83
+ - **Node.js 18+**: Full support
94
84
 
95
85
  ## Development
96
86