words-pt

1.0.23 • Public • Published

Node.js CI 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.

Install

npm i words-pt

How to use

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

54

Version

1.0.23

License

GPL-3.0

Unpacked Size

2.47 MB

Total Files

9

Last publish

Collaborators

  • jfolpf