https://github.com/chanind/penman-js
Abstract Meaning Representation (AMR) parser and generator for Javascript
Science Score: 26.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
○Academic publication links
-
○Committers with academic emails
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (13.9%) to scientific vocabulary
Keywords
Keywords from Contributors
Repository
Abstract Meaning Representation (AMR) parser and generator for Javascript
Basic Info
- Host: GitHub
- Owner: chanind
- License: mit
- Language: TypeScript
- Default Branch: main
- Homepage: https://chanind.github.io/penman-js/
- Size: 956 KB
Statistics
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 1
- Releases: 0
Topics
Metadata Files
README.md
penman-js
Javascript port of the Penman Python library for Abstract Meaning Representation (AMR).
Full docs: https://chanind.github.io/penman-js
About
This library, including documentation, is a manual port of the Penman Python library. All functionality available in the original library should also be available in this library, with similar usage and semantics. The Python library should still be considered the main project for new features. If you find that behavior differs between these libraries, please open a Github issue.
The goal of this project is to bring the power of the Penman Python library's AMR parsing and generation to the browser and Node.js. This project does not provide a CLI interface for manipulating AMR, since the Python library already provides that functionality.
Installation
Installation is via NPM:
npm install penman-js
Basic usage
The most faithful representation of AMR text in the library is the Tree class. The parse function turns an AMR text string into a Tree, and format does the reverse, turning a Tree back into a string.
```js import { parse, format } from 'penman-js';
const t = penman.parse('(w / want-01 :ARG0 (b / boy) :ARG1 (g / go :ARG0 b))'); const [variable, branches] = t.node; console.log(variable); // ouput: 'w' console.log(branches.length); // output: 3 const [role, target] = branches[2]; console.log(role); // output: ':ARG1' console.log(format(target)); // (g / go // :ARG0 b) ```
Users wanting to interact with graphs might find the decode and
encode functions a good place to start.
```js import { encode, decode } from 'penman-js'; const g = penman.decode('(w / want-01 :ARG0 (b / boy) :ARG1 (g / go :ARG0 b))'); console.log(g.top); // 'w' console.log(g.triples.length); // 6 console.log(g.instances().map((instance) => instance[2])); // ['want-01', 'boy', 'go']
console.log(encode(g, { top: 'b' })); // (b / boy // :ARG0-of (w / want-01 // :ARG1 (g / go // :ARG0 b))) ```
See https://chanind.github.io/penman-js for full docs.
Contributing
Contributions are welcome! If you notice any bugs or have ideas for improvements, please either file an issue or open a pull request.
Development
This project is written in Typescript, using yarn for dependency management, eslint for linting, and ava for tests. Install dependencies with yarn install. To run linting and tests, run yarn test.
Acknowledgements
This library, including documentation, is a manual port of the Penman Python library, and as such, all credit for the original code and docs work goes to github.com/goodmami/penman.
Owner
- Name: David Chanin
- Login: chanind
- Kind: user
- Location: London, UK
- Company: UCL
- Website: https://chanind.github.io
- Repositories: 97
- Profile: https://github.com/chanind
GitHub Events
Total
- Watch event: 1
Last Year
- Watch event: 1
Committers
Last synced: 10 months ago
Top Committers
| Name | Commits | |
|---|---|---|
| David Chanin | c****v@g****m | 47 |
| semantic-release-bot | s****t@m****t | 6 |
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: 11 months ago
All Time
- Total issues: 0
- Total pull requests: 3
- Average time to close issues: N/A
- Average time to close pull requests: 7 minutes
- Total issue authors: 0
- Total pull request authors: 1
- Average comments per issue: 0
- Average comments per pull request: 0.0
- Merged pull requests: 2
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 0
- Pull requests: 0
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Issue authors: 0
- Pull request authors: 0
- Average comments per issue: 0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
Pull Request Authors
- chanind (5)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 1
-
Total downloads:
- npm 18 last-month
- Total dependent packages: 0
- Total dependent repositories: 0
- Total versions: 6
- Total maintainers: 1
npmjs.org: penman-js
javascript port of penman Python library for AMR
- Homepage: https://github.com/chanind/penman-js#readme
- License: MIT
-
Latest release: 2.0.2
published over 2 years ago