# phraser

> A small natural language generator. Makes words reads goods.

Latest version **0.4.0** (published 2017-09-11) · MIT license · 0 weekly downloads

## Install

```sh
npm install phraser
pnpm add phraser
yarn add phraser
bun add phraser
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.4.0 |
| Published | 2017-09-11 |
| First published | 2017-03-08 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| Author | Damien Clarke |
| Maintainers | dxinteractive |

## Links

- npm: https://www.npmjs.com/package/phraser
- Repository: https://github.com/dxinteractive/phraser
- Homepage: https://github.com/dxinteractive/phraser#readme
- Issues: https://github.com/dxinteractive/phraser/issues
- npm.io page: https://npm.io/package/phraser

## Dependencies (1)

- [immutable](https://npm.io/package/immutable.md) ^3.8.1

## Recent versions

- 0.4.0 (latest) — 2017-09-11
- 0.3.0 — 2017-09-11
- 0.2.0 — 2017-08-22
- 0.1.0 — 2017-04-05
- 0.0.11 — 2017-03-17
- 0.0.10 — 2017-03-15
- 0.0.9 — 2017-03-15
- 0.0.8 — 2017-03-13
- 0.0.7 — 2017-03-10
- 0.0.6 — 2017-03-10
- 0.0.5 — 2017-03-09
- 0.0.4 — 2017-03-09
- 0.0.3 — 2017-03-08
- 0.0.2 — 2017-03-08
- 0.0.1 — 2017-03-08

## README

# phraser
[![phraser npm](https://img.shields.io/npm/v/phraser.svg?style=flat-square)](https://www.npmjs.com/package/phraser)


## Early stages of development, please prepare for large amounts of changes until version 1.0.0.

A small natural language generator. Makes words reads goods.

- [API Documentation](https://blueflag.github.io/phraser/docs)

Phraser allows you to construct sentences using a syntax similar to sentence syntax trees, and render these to arrays of strings. Right now the development focus is on the lowest layer of language generation, which allows sentences to be defined by their sentence structure. This enforces basic grammar rules about valid word orders, pluralisation, verb tense / aspect / person / number and simple punctuation.

Use [Foxtype](https://foxtype.com/sentence-tree) to help visualise sentences in terms of their structure.

Over time this will be supported by lexicons so irregular verbs and pluralisations don't have to be manually provided. Then all this will form a solid base for a second layer of opinionated sentence constructors that will be able to take data and output sentence structures.

### Example usage

```
import {Constituent} from 'phraser';
const {Sentence, Clause, NP, PP, VP} = Constituent(Lexicon);

const sentence = Sentence(
    Clause(
        NP("dog").quantity(3).determiner("those"),
        VP("ate", NP("food")).adverb("quickly", "middle")
    ).modifier(
        PP("from", NP("trash can").a().adjective("huge"))
    )
);

console.log(sentence.renderString());

// outputs "Those 3 dogs quickly ate food from a huge trash can."

```

---
_Source: https://npm.io/package/phraser · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
