npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

pret

v0.0.2

Published

Simple translation package for Node.js

Downloads

100

Readme

Pret

Pret is a simple human language translation package for Node.js.

It can be used either as a translation module in any Node.js program or as a standalone command line translation tool. It supports not only single word translation but also batch mode which provides word by word translation. For now it uses Collins Cobuild explanatory dictionary which of course not translation dictionary, therefore, Pret returns word explanation. Other dsl dictionaries can be added manually.

Usage

Single word mode

const pret = require('pret');

cosole.log(pret.translate('help'));    

Batch mode

const pret = require('pret');
var text = 'There is no word which is impossible to explain.'
cosole.log(pret.translateBatch(text));

CLI Examples

as simple command

pret saw
[sɔ͟ː]
saws, sawing, sawed, sawn
1) Saw is the past tense of see.
2) N-COUNT A saw is a tool for cutting wood, which has a blade with sharp
teeth along one edge. Some saws are pushed backwards and forwards by hand,
and others are powered by electricity.
→ See also chain saw
3) VERB If you saw something, you cut it with a saw.
[V prep/adv] He escaped by sawing through the bars of his cell...
[V n] Your father is sawing wood.

or as a pipe

echo 'saw mock' | pret
saw
[sɔ͟ː]
saws, sawing, sawed, sawn
1) Saw is the past tense of see.
2) N-COUNT A saw is a tool for cutting wood, which has a blade with sharp
teeth along one edge. Some saws are pushed backwards and forwards by hand,
and others are powered by electricity.
→ See also chain saw
3) VERB If you saw something, you cut it with a saw.
[V prep/adv] He escaped by sawing through the bars of his cell...
[V n] Your father is sawing wood.

mock
[mɒ̱k]

mocks, mocking, mocked
1) VERB If someone mocks you, they show or pretend that they think you are
foolish or inferior, for example by saying something funny about you, or
by imitating your behaviour.
[V n] I thought you were mocking me...
[V n] I distinctly remember mocking the idea...
[V with quote] `I'm astonished, Benjamin,' she mocked.
2) ADJ: ADJ n You use mock to describe something which is not real or
genuine, but which is intended to be very similar to the real thing.
`It's tragic!' swoons Jeffrey in mock horror...
One of them was subjected to a mock execution.
...a mock Tudor mansion.
3) N-COUNT: usu pl Mocks are practice exams that you take as part of your
preparation for real exams. [BRIT, INFORMAL]
She went from a D in her mocks to a B in the real thing.

API

Retrive translation for single word

pret.translate('word');

Retrive translation for many words

pret.translateBatch('word help go');
pret.translateBatch(['word', 'help', 'go']);

Set other dictionary

const fs = require('fs');
var dict = fs.readFileSync('./OxfordEnglish.dsl', 'UTF8');
pret.setDictionary(dict);

Get current dictionary

var dict = pret.getDictionary();