words-pt

1.0.21 • Public • Published

Node.js CI CodeQL Security Check Coverage Status Known Vulnerabilities js-standard-style
Donate with librepay Donate with librepay

The list of all the words in Portuguese, including all possible combinations and variations (masculine, feminine, plural, singular, verbal conjugations, etc.). This is based on the great work from the professors of the University of Minho, and the all the files can be accessed here.

how to use

Install it

npm i words-pt

and then use the API

const wordsPt = require('words-pt')

// { removeNames: true } removes names such as 'Lisboa' or 'António'
wordsPt.init({ removeNames: true }, err => {
  if (err) {
    // handle the error
    return
  }
  wordsPt.isWord('ser') // true
  wordsPt.isWord('serei') // true
  wordsPt.isWord('abafar-nos-ão') // true
  wordsPt.isWord('hello') // false

  wordsPt.randomWord() // grafonolas (any random word)
  wordsPt.randomWord('a') // amealhará (starting with 'a')
  wordsPt.randomWord('abc') // abcissa (starting with 'abc')
  // words.Pt.randomWord('abc') is equivalent to words.Pt.randomWord('abc', '*', '*')  

  // words.Pt.randomWord(beginningPart, middlePart, endPart)
  wordsPt.randomWord('ab', '*', '*') // 'abcesso'
  wordsPt.randomWord('a', 'e', '*') // 'abcesso' but not 'abade'
  wordsPt.randomWord('*', 's', '*') // 'espesso' but not 'sapato' nor 'mamas'
  wordsPt.randomWord('*', '*', 's') // 'mamas'
  wordsPt.randomWord('t', '*', 's') // 'tetas'
  wordsPt.randomWord('t', 'et', 'as') // 'tetanizarias'
  wordsPt.randomWord('se', 'o', 's') // 'seios'
  wordsPt.randomWord('sa', 'a', 'to') // 'salteamento'

  // exactly the same as randomWord, but gets all the words
  wordsPt.getArray() // array with all the words
  wordsPt.getArray('abc') // ['abcesso', 'abcessos', 'abcissa', 'abcissas']
  wordsPt.getArray('t', 'et', 'as') // ['tabuletas', 'tchetchenas', 'telefotometrias', 'telemetrias', ... ]
  wordsPt.getArray('tet', 'a', 's') // ['tetanizadas', 'tetanizados', 'tetanizais' , 'tetanizamos', ... ]

  words.Pt.biggestWord() // constitucionalizar-lhes-íamos
  // do something more
})

just the file

If you simply want for the plain file, wherein the words are separated by newlines \n, check the present file wordsList.zip. The corresponding unzipped file is encoded in iso-8859-1.

Readme

Keywords

Package Sidebar

Install

npm i words-pt

Weekly Downloads

164

Version

1.0.21

License

GPL-3.0

Unpacked Size

2.48 MB

Total Files

10

Last publish

Collaborators

  • jfolpf