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

compromise-speech

Package Overview
Dependencies
Maintainers
0
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

compromise-speech

plugin for nlp-compromise

  • 0.1.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.8K
increased by88.68%
Maintainers
0
Weekly downloads
 
Created
Source
pronounciation metadata plugin for compromise
npm install compromise-speech

Syllables

Tokenize a word approximately by it's pronounced syllables. We use a custom rule-based alortithm for this.

import plg from 'compromise-speech'
nlp.extend(plg)

let doc = nlp('seventh millenium. white collar')
doc.syllables()
[ [ 'se', 'venth', 'mil', 'le', 'nium' ], [ 'white', 'col', 'lar' ] ]

Alternatively, if you'd like to combine syllable information with other properties, you can use .compute('syllables')

let doc = nlp('edmonton oilers')
doc.compute('syllables')
doc.json()
/*[{
  "terms": [
    {
      "normal": "edmonton",
      "syllables": ["ed", "mon", "ton"]
    },
    {
      "normal": "oilers",
      "syllables": ["oi", "lers"]
    }
  ]
}]
*/

SoundsLike

Generate an expected pronounciation for the word, as a normalized string. We use the metaphone implementation, which is a simple rule-based pronounciation system.

import plg from 'compromise-speech'
nlp.extend(plg)

let doc = nlp('seventh millenium. white collar')
doc.soundsLike()
// [ [ 'sefenth', 'milenium' ], [ 'wite', 'kolar' ] ]

Alternatively, if you'd like to combine syllable information with other properties, you can use .compute('syllables')

let doc = nlp('edmonton oilers')
doc.compute('soundsLike')
doc.json()
/*[{
  "terms": [
    {
      "normal": "edmonton",
      "soundsLike": "etmonton"
    },
    {
      "normal": "oilers",
      "soundsLike": "oilers"
    }
  ]
}]
*/

MIT

FAQs

Package last updated on 16 Oct 2024

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