depedits
v0.0.1
Published
TypeScript port of DepEdit, the NLP tool for manipulating dependency trees and grammars
Maintainers
Readme
DepEdit_TS
TypeScript port of DepEdit – a rule-based universal dependency grammar editor and corrector.
This library is self-contained: the four classic configurations are embedded, so no external .ini files are required.
Features
- Full CoNLL-U parser/serializer
- Definition matching with regex, conjunctions, negation
- Relations:
#1>#2,#1~#2,#1.#2,#1.*#2,#1.1,5#2 - Actions: field set/append/remove, head rewiring, enhanced deps, sentence annotations,
$1capture substitution - Built-in presets:
- STAN2UNI – Stanford Typed Dependencies → Universal Dependencies
- ENG_SENT_TYPE – GUM sentence typing
- ENG_ENHANCE – enhanced UD (xsubj, case/mark augmentation, conj propagation)
- ENG_MORPH – morphological features
Install
npm install
npm run buildLibrary usage
import { convertStanfordToUD, fullEnglishPipeline, DepEditEngine } from 'DepEdit_TS';
const ud = convertStanfordToUD(stanfordConllu);
const full = fullEnglishPipeline(stanfordConllu);
// custom
const engine = new DepEditEngine();
engine.loadIniString(myRules);
const out = engine.process(conllu);CLI
npx depedit-ts stan2uni input.conllu output.conllu
npx depedit-ts pipeline input.conllu
npx depedit-ts run myrules.ini input.conllu
cat file.conllu | depedit-ts enhanceProject structure
/src
types.ts # Token, Sentence interfaces
utils.ts # field aliases, relations
matcher.ts # DefinitionMatcher
transformation.ts # Transformation parser
engine.ts # DepEditEngine core
presets.ts # embedded INIs + factories
index.ts # public exports
cli.ts # command-line entryTesting
The repo includes a Vitest suite covering the core transformations.
npm install
npm testTests validate:
- Stanford
dobj→ UDobj prep+pobj→case+nmod- Morphological features (Number, VerbForm, etc.)
- Sentence typing (
# s_type = wh) - Enhanced dependencies
Run in watch mode:
npm run test:watchPublishing to npm
- Build:
npm run build- Login:
npm login- Publish (public):
npm publishThe package.json includes:
"files": ["dist", "README.md", "LICENSE"]– only compiled output ships"prepublishOnly": "npm run build"– ensures dist is fresh"publishConfig": {"access": "public"}
Recommended .npmignore excludes src/ and tests/.
