agent-simple-english 0.1.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/.claude-plugin/marketplace.json +23 -0
- package/.claude-plugin/plugin.json +12 -0
- package/LICENSE +21 -0
- package/README.md +435 -0
- package/THIRD_PARTY_NOTICES.md +13 -0
- package/commands/ste.md +13 -0
- package/hooks/hooks.json +58 -0
- package/package.json +64 -0
- package/src/adapter/commit-message.ts +472 -0
- package/src/adapter/feedback.ts +40 -0
- package/src/adapter/rule-summary.ts +79 -0
- package/src/cli/hook.ts +681 -0
- package/src/cli/main.ts +201 -0
- package/src/cli/session-command.ts +78 -0
- package/src/cli/session-state.ts +214 -0
- package/src/config/load.ts +85 -0
- package/src/config/merge.ts +20 -0
- package/src/config/schema.ts +69 -0
- package/src/dictionary/README.md +18 -0
- package/src/dictionary/data/pi-ste.json +200 -0
- package/src/dictionary/form.ts +6 -0
- package/src/dictionary/load.ts +54 -0
- package/src/dictionary/schema.ts +28 -0
- package/src/engine/comments.ts +386 -0
- package/src/engine/diff.ts +328 -0
- package/src/engine/identifiers.ts +20 -0
- package/src/engine/kinds.ts +43 -0
- package/src/engine/lint.ts +530 -0
- package/src/engine/markdown.ts +338 -0
- package/src/engine/paragraphs.ts +105 -0
- package/src/engine/rules/contraction.ts +19 -0
- package/src/engine/rules/dictionary.ts +281 -0
- package/src/engine/rules/hedging.ts +27 -0
- package/src/engine/rules/marketing.ts +71 -0
- package/src/engine/rules/paragraph-length.ts +23 -0
- package/src/engine/rules/phrasal-verb.ts +57 -0
- package/src/engine/rules/registry.ts +15 -0
- package/src/engine/rules/semicolon.ts +14 -0
- package/src/engine/rules/sentence-length.ts +24 -0
- package/src/engine/rules/verb-form.ts +76 -0
- package/src/engine/scan.ts +15 -0
- package/src/engine/sentences.ts +285 -0
- package/src/engine/tagger.ts +8 -0
- package/src/engine/tokens.ts +2 -0
- package/src/engine/types.ts +45 -0
- package/src/extension/index.ts +755 -0
- package/src/tagger/wink.ts +44 -0
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { Context, Layer } from "effect"
|
|
2
|
+
import model from "wink-eng-lite-web-model"
|
|
3
|
+
import winkNLP, { type ItemToken, type ItsFunction } from "wink-nlp"
|
|
4
|
+
import type { TaggedToken, Tagger } from "../engine/tagger.ts"
|
|
5
|
+
|
|
6
|
+
export function makeWinkTagger(): Tagger {
|
|
7
|
+
const nlp = winkNLP(model, ["sbd", "pos"])
|
|
8
|
+
const its = nlp.its
|
|
9
|
+
// wink-nlp's d.ts declares its.lemma with a signature token.out() rejects;
|
|
10
|
+
// at runtime it is a valid token helper, so cast to the accepted shape.
|
|
11
|
+
const lemma = its.lemma as unknown as ItsFunction<string>
|
|
12
|
+
return (text) => {
|
|
13
|
+
const doc = nlp.readDoc(text)
|
|
14
|
+
const tokens: TaggedToken[] = []
|
|
15
|
+
// wink-nlp does not expose character offsets, so recover them by scanning
|
|
16
|
+
// for each token value in order; values are verbatim slices of the input.
|
|
17
|
+
let cursor = 0
|
|
18
|
+
doc.tokens().each((token: ItemToken) => {
|
|
19
|
+
const value = token.out(its.value)
|
|
20
|
+
const found = text.indexOf(value, cursor)
|
|
21
|
+
const offset = found === -1 ? cursor : found
|
|
22
|
+
tokens.push({
|
|
23
|
+
text: value,
|
|
24
|
+
pos: token.out(its.pos),
|
|
25
|
+
lemma: token.out(lemma),
|
|
26
|
+
offset,
|
|
27
|
+
})
|
|
28
|
+
cursor = offset + value.length
|
|
29
|
+
})
|
|
30
|
+
return tokens
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export class TaggerService extends Context.Tag("TaggerService")<TaggerService, Tagger>() {}
|
|
35
|
+
|
|
36
|
+
const makeLazyWinkTagger = (): Tagger => {
|
|
37
|
+
let tagger: Tagger | undefined
|
|
38
|
+
return (text) => {
|
|
39
|
+
tagger ??= makeWinkTagger()
|
|
40
|
+
return tagger(text)
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export const WinkTaggerLive = Layer.sync(TaggerService, makeLazyWinkTagger)
|