@mailwoman/phrase-grouper 4.10.0 → 4.12.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.
- package/README.md +77 -0
- package/package.json +2 -2
package/README.md
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# @mailwoman/phrase-grouper
|
|
2
|
+
|
|
3
|
+
**Stage 2.7 of the Mailwoman runtime pipeline** — phrase boundary discovery.
|
|
4
|
+
|
|
5
|
+
Proposes coherent input units with a structural kind hypothesis and confidence.
|
|
6
|
+
Decouples boundary discovery from type classification: Stage 3 conditions on
|
|
7
|
+
these proposals so it answers the simpler "what type is this proposed span?"
|
|
8
|
+
rather than jointly discovering boundaries and types.
|
|
9
|
+
|
|
10
|
+
```ts
|
|
11
|
+
import { groupPhrases } from "@mailwoman/phrase-grouper"
|
|
12
|
+
|
|
13
|
+
const groups = groupPhrases(normalizedInput, queryShape, localeHint)
|
|
14
|
+
// groups → [
|
|
15
|
+
// {text: "1600 Amphitheatre Parkway", kind: "street_phrase", confidence: 0.95},
|
|
16
|
+
// {text: "Mountain View", kind: "locality_phrase", confidence: 0.8},
|
|
17
|
+
// {text: "CA", kind: "region_abbreviation", confidence: 0.99},
|
|
18
|
+
// {text: "94043", kind: "postcode", confidence: 0.98},
|
|
19
|
+
// ]
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## What it proposes
|
|
23
|
+
|
|
24
|
+
| Phrase kind | Triggers |
|
|
25
|
+
| --------------------- | ----------------------------------------------------------- |
|
|
26
|
+
| `street_phrase` | Number + capitalized words, hyphenated street names |
|
|
27
|
+
| `locality_phrase` | Capitalized word sequence after comma, near region/postcode |
|
|
28
|
+
| `venue_phrase` | Leading capitalized word sequence before a street phrase |
|
|
29
|
+
| `postcode` | Known postcode format (ZIP5, UK outward, etc.) |
|
|
30
|
+
| `region_abbreviation` | US state / CA province / AU state abbreviations |
|
|
31
|
+
| `numeric` | Standalone number (potential house number) |
|
|
32
|
+
| `hyphenated_compound` | Hyphenated pairs (`Jean-Jacques`, `Winston-Salem`) |
|
|
33
|
+
|
|
34
|
+
## API
|
|
35
|
+
|
|
36
|
+
```ts
|
|
37
|
+
groupPhrases(
|
|
38
|
+
input: NormalizedInputLite,
|
|
39
|
+
shape: QueryShapeLike,
|
|
40
|
+
locale?: LocaleHint
|
|
41
|
+
): Promise<PhraseGroup[]>
|
|
42
|
+
|
|
43
|
+
groupPhrasesSync(
|
|
44
|
+
input: NormalizedInputLite,
|
|
45
|
+
shape: QueryShapeLike,
|
|
46
|
+
locale?: LocaleHint
|
|
47
|
+
): PhraseGroup[]
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Pipeline position
|
|
51
|
+
|
|
52
|
+
```
|
|
53
|
+
kind-classifier → phrase-grouper → classifier (neural/rule-based) → ...
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Design
|
|
57
|
+
|
|
58
|
+
- **Boundary discovery, not classification.** The phrase grouper answers "where
|
|
59
|
+
are the coherent units?" — the classifier answers "what _type_ is each unit?"
|
|
60
|
+
This separation makes both problems easier.
|
|
61
|
+
- **Bitter-lesson-safe:** uses only universal structural cues (proximity,
|
|
62
|
+
punctuation, capitalization, hyphenation, format-shape repetition). Never
|
|
63
|
+
place-name dictionaries. A learned span proposer is reserved for a future
|
|
64
|
+
release.
|
|
65
|
+
- **Rule-based v1.** Ships in `@mailwoman/phrase-grouper`; consumed by the
|
|
66
|
+
pipeline coordinator in `@mailwoman/core`.
|
|
67
|
+
|
|
68
|
+
## Related
|
|
69
|
+
|
|
70
|
+
- [`@mailwoman/core`](../core) — pipeline coordinator that consumes phrase groups
|
|
71
|
+
- [`@mailwoman/kind-classifier`](../kind-classifier) — preceding stage
|
|
72
|
+
- [The Knowledge Ladder](https://mailwoman.sister.software/articles/concepts/the-knowledge-ladder/) — design rationale
|
|
73
|
+
- [Staged Pipeline Contract](https://mailwoman.sister.software/articles/plan/reference/STAGES/)
|
|
74
|
+
|
|
75
|
+
## License
|
|
76
|
+
|
|
77
|
+
[AGPL-3.0-only](https://www.gnu.org/licenses/agpl-3.0.html)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mailwoman/phrase-grouper",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.12.0",
|
|
4
4
|
"description": "Stage 2.7 of the runtime pipeline — propose coherent input units (boundary discovery) with a structural kind hypothesis + confidence. Rule-based v1 (port of v1 section/sub-section logic); learned 1-2M-param span proposer reserved for v0.5.1.",
|
|
5
5
|
"license": "AGPL-3.0-only",
|
|
6
6
|
"repository": {
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
".": "./out/index.js"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@mailwoman/core": "4.
|
|
17
|
+
"@mailwoman/core": "4.12.0"
|
|
18
18
|
},
|
|
19
19
|
"files": [
|
|
20
20
|
"out/**/*.js",
|