Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@autheur/generator

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@autheur/generator

Random french sentence generator

  • 1.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

@autheur/generator

Random french sentence generator

Installation

npm i @autheur/generator

Usage

The core function is generate: it permits to generate a sentence given a pattern

import { generate, determinant, noun, adverb, adjective } from '@autheur/generator';

const sentence = generate([determinant(), noun(), adverb(), adjective()]);

console.log(sentence);
// leurs taille-crayons à demi alourdis

Generators

A generator permits to define a portion of the sentence

determinant

Generate a determinant (un, une, le, les, cette, ...)

import { generate, determinant } from '@autheur/generator';

generate([determinant()]); // mon

You can specify which types of determinant you want between undefined, defined, possessive, demonstrative

import { generate, determinant } from '@autheur/generator';

generate([determinant({ types: ['possessive'] })]); // notre

noun

Generate a noun.

  • the noun generated will impose its form (gender + plurality) to the rest of the sentence.
  • by default the plurality is randomly chosen
import { generate, noun } from '@autheur/generator';

generate([noun()]); // allumette

You can force the plurality with a parameter

import { generate, determinant } from '@autheur/generator';

generate([noun({ isPlural: true })]); // animaux
generate([noun({ isPlural: false })]); // ampoule

comma

Generate a comma.

import { generate, comma } from '@autheur/generator';

generate([comma()]); // ,

adverb

Generate an adverb.

import { generate, adverb } from '@autheur/generator';

generate([adverb()]); // suffisamment

word

Generate an word that you specify.

import { generate, word } from '@autheur/generator';

generate([word('foobar')]); // foobar

You can specify if your word is preceded or followed by a space if their is another word

import { generate, word } from '@autheur/generator';

generate([word("l'", { noSpaceAfter: true }), word('arbre')]); // l'arbre
generate([word("l'"), word('arbre', { noSpaceBefore: true })]); // l'arbre

Other packages

This is a from a monorepo with the following packages:

PackageDescription
@autheur/datasetDataset of sorted french words broke down by categories
@autheur/generatorThe generator itself with they logic
@autheur/operatorsUtilities to manipulate words (ex: pluralize, feminize, ...)

Credits

Coded with ❤️ by Corentin Thomasset.

License

This project is under the MIT license.

Keywords

FAQs

Package last updated on 30 Apr 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc