# bmjs-engsentence

> An English utility object with methods designed for generating different sentence elements.

Latest version **1.0.0** (published 2017-11-06) · MIT license · 0 weekly downloads

## Install

```sh
npm install bmjs-engsentence
pnpm add bmjs-engsentence
yarn add bmjs-engsentence
bun add bmjs-engsentence
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2017-11-06 |
| First published | 2017-11-06 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Brent McCoy |
| Maintainers | brent258 |
| Keywords | english, javascript, nodejs |

## Links

- npm: https://www.npmjs.com/package/bmjs-engsentence
- Repository: https://github.com/brent258/bmjs-engsentence
- Homepage: https://github.com/brent258/bmjs-engsentence#readme
- Issues: https://github.com/brent258/bmjs-engsentence/issues
- npm.io page: https://npm.io/package/bmjs-engsentence

## Dependencies (4)

- [bmjs-random](https://npm.io/package/bmjs-random.md) ^1.0.0
- [bmjs-engverb](https://npm.io/package/bmjs-engverb.md) ^1.0.2
- [bmjs-engperson](https://npm.io/package/bmjs-engperson.md) ^1.0.0
- [bmjs-engpronouns](https://npm.io/package/bmjs-engpronouns.md) ^1.0.0

## Recent versions

- 1.0.0 (latest) — 2017-11-06

## README

# bmjs-engsentence
An English utility for randomly generating printed paragraphs from given sentence data, with methods for extracting or replacing data from URL sources.

```javascript
const sentence = require('bmjs-engsentence');
```
Use object literals or external JSON files for sentence data:

```json
{
  "sentenceObj": {
    "subject": ["Bill"],
    "subjectPronoun": "he",
    "verb": ["be"],
    "verbOptions": [0,0,0],
    "tense": "present",
    "complement": ["happy"],
    "object": [""],
    "objectPronoun": "it",
    "passive": [""],
    "adverbBefore": [""],
    "adverbAfter": [""],
    "adjunctBefore": [""],
    "adjunctMoveable": [""],
    "adjunctAfter": [""],
    "adjunctRequired": false,
    "conjunctionBefore": [""],
    "conjunctionMoveable": [""],
    "conjunctionAfter": [""]
  },
  "pathOne": "",
  "keywordOne": "",
  "pathTwo": "",
  "keywordTwo": ""
}
```
Add sentences with optional tags for grouping, then generate a string and output:

```javascript
const sentence = require('bmjs-engsentence');
const rand = require('bmjs-random');

module.exports = function(url) {
  sentence.init();
  let paths, index, randomlyAdd;
  // Settings for sentence to add
  if (url) {
    sentence.sourceFromUrl(url);
  }
  paths = ['test/test-sentence'];
  index = Math.floor(Math.random() * paths.length);
  randomlyAdd = rand(true);
  if (paths.length >= index && randomlyAdd && (sentence.sourceContains(['search','terms']) || !url)) {
    sentence.addWithTagFromPath('tag',paths[index]);
  }
  paths.splice(index,1);
  // Print when all tags added
  sentence.printFromTags();
  // Replace keywords from sources
  sentence.sourceReplace(/happy/,/<source>\w+<\/source>/,'<source>joyous</source>');
  // Output sentences
  return sentence.out();
  // returns 'Bill is joyous.'
};
```

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