compromise-speech 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,18 +1,19 @@
1
1
  {
2
2
  "name": "compromise-speech",
3
3
  "description": "plugin for nlp-compromise",
4
- "version": "0.1.0",
4
+ "version": "0.1.1",
5
5
  "author": "Spencer Kelly <spencermountain@gmail.com> (http://spencermounta.in)",
6
6
  "main": "./src/plugin.js",
7
7
  "unpkg": "./builds/compromise-speech.min.js",
8
8
  "module": "./builds/compromise-speech.mjs",
9
9
  "type": "module",
10
- "types": "index.d.ts",
11
10
  "sideEffects": false,
11
+ "types": "./index.d.ts",
12
12
  "exports": {
13
13
  ".": {
14
14
  "import": "./src/plugin.js",
15
- "require": "./builds/compromise-speech.cjs"
15
+ "require": "./builds/compromise-speech.cjs",
16
+ "types": "./index.d.ts"
16
17
  }
17
18
  },
18
19
  "repository": {
@@ -23,12 +24,17 @@
23
24
  "scripts": {
24
25
  "test": "tape \"./tests/**/*.test.js\" | tap-dancer --color always",
25
26
  "testb": "TESTENV=prod tape \"./tests/**/*.test.js\" | tap-dancer --color always",
26
- "watch": "amble ./scratch.js",
27
+ "watch": "node --watch ./scratch.js",
27
28
  "build": "rollup -c --silent"
28
29
  },
29
30
  "eslintIgnore": [
30
31
  "builds/*.js"
31
32
  ],
33
+ "files": [
34
+ "builds/",
35
+ "src/",
36
+ "index.d.ts"
37
+ ],
32
38
  "peerDependencies": {
33
39
  "compromise": ">=14.0.0"
34
40
  },
package/demo/index.html DELETED
@@ -1,28 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
-
4
- <head>
5
-
6
- <script src="https://unpkg.com/compromise"></script>
7
- <!-- <script src="https://unpkg.com/compromise-speech"></script> -->
8
- <script src="../builds/compromise-speech.min.js"></script>
9
-
10
- </head>
11
-
12
- <body>
13
- <p>compromise-speech demo:</p>
14
- <ul>
15
- <kbd>chocolate microscopes </kbd>
16
- <pre id="res">loading</pre>
17
- </ul>
18
-
19
- <script defer>
20
- nlp.plugin(compromiseSpeech) // window.compromiseSpeech
21
- let txt = document.querySelector('kbd').innerText
22
- let doc = nlp(txt)
23
- let json = doc.syllables()
24
- document.querySelector('#res').innerHTML = JSON.stringify(json, null, 2)
25
- </script>
26
- </body>
27
-
28
- </html>
package/rollup.config.js DELETED
@@ -1,23 +0,0 @@
1
- import { terser } from 'rollup-plugin-terser'
2
- import sizeCheck from 'rollup-plugin-filesize-check'
3
- import { nodeResolve } from '@rollup/plugin-node-resolve';
4
-
5
- const opts = { keep_classnames: true, module: true }
6
-
7
- export default [
8
- {
9
- input: 'src/plugin.js',
10
- output: [{ file: 'builds/compromise-speech.cjs', format: 'umd', name: 'compromiseSpeech' }],
11
- plugins: [nodeResolve(), sizeCheck({ expect: 11, warn: 15 })],
12
- },
13
- {
14
- input: 'src/plugin.js',
15
- output: [{ file: 'builds/compromise-speech.min.js', format: 'umd', name: 'compromiseSpeech' }],
16
- plugins: [nodeResolve(), terser(opts), sizeCheck({ expect: 4, warn: 15 })],
17
- },
18
- {
19
- input: 'src/plugin.js',
20
- output: [{ file: 'builds/compromise-speech.mjs', format: 'esm' }],
21
- plugins: [nodeResolve(), terser(opts), sizeCheck({ expect: 4, warn: 15 })],
22
- }
23
- ]
package/scratch.js DELETED
@@ -1,17 +0,0 @@
1
- /* eslint-disable no-console, no-unused-vars */
2
- import nlp from '../../src/three.js'
3
-
4
- import speechPlugin from './src/plugin.js'
5
- nlp.plugin(speechPlugin)
6
- // nlp.verbose(true)
7
- // nlp.verbose('date')
8
-
9
- let txt = ''
10
- txt = 'seventh millenium. white collar'
11
-
12
- // let doc = nlp(txt).compute(['soundsLike', 'syllables'])
13
- // console.dir(doc.json()[0], { depth: 5 })
14
-
15
- let doc = nlp('calgary')
16
- doc.compute('soundsLike')
17
- console.log(JSON.stringify(doc.json()[0], null, 2))
package/tests/_lib.js DELETED
@@ -1,15 +0,0 @@
1
- import build from '../../../builds/one/compromise-one.mjs'
2
- import src from '../../../src/one.js'
3
- import plgBuild from '../builds/compromise-speech.mjs'
4
- import plg from '../src/plugin.js'
5
- let nlp;
6
-
7
- if (process.env.TESTENV === 'prod') {
8
- console.warn('== production build test 🚀 ==') // eslint-disable-line
9
- nlp = build
10
- nlp.plugin(plgBuild)
11
- } else {
12
- nlp = src
13
- nlp.plugin(plg)
14
- }
15
- export default nlp
@@ -1,21 +0,0 @@
1
- import test from 'tape'
2
- import nlp from './_lib.js'
3
-
4
- test('soundsLike-tests', function (t) {
5
- let arr = [
6
- ['phil collins', 'fil kolins'],
7
- ['Philadelphia freedom', 'filatelfia fretom'],
8
- ['Shine on me', 'shine on me'],
9
- ['peace of mind', 'pease of mint'],
10
- ['Yes I do', 'yes i to'],
11
- ['Zapped me', 'sapet me'],
12
- ['Right between the eyes', 'rit betwen the eyes'],
13
- // ['But the times have changed', 'but the times hafe kshanjet'],
14
- ]
15
- arr.forEach((a) => {
16
- let doc = nlp(a[0])
17
- let str = doc.soundsLike({})[0].join(' ')
18
- t.equal(str, a[1], a[0])
19
- })
20
- t.end()
21
- })
@@ -1,73 +0,0 @@
1
- import test from 'tape'
2
- import nlp from './_lib.js'
3
-
4
- const words = [
5
- 'sud den ly',
6
- 'con sti pa tion',
7
- 'di a bo lic',
8
- 'fa ted',
9
- 'ge ne tic',
10
- 'hy giene',
11
- 'o ma ha',
12
- 'i mi ta ted',
13
- 'tree',
14
- 'ci vi lised',
15
- 'went',
16
- 'to ge ther',
17
- 'tog gle',
18
- 'move ment',
19
- 'mo ment',
20
- 'do nate',
21
- 'vi king',
22
- 'wat tage',
23
- 'con gre gate',
24
- 'some thing',
25
- 'sales man',
26
- 're sour ces',
27
- 'eve ry thing',
28
- 'eve ry bo dy',
29
- 'hole',
30
- 'ho ly',
31
- 'sec ret',
32
- 'cause',
33
- 'fate',
34
- 'fates',
35
- 'eu lo gy',
36
- 'e on',
37
- 'rea sons',
38
- 'and',
39
- 'hoc key',
40
- 'wild',
41
- 'fun',
42
- 'fun ny',
43
- 'hor ses',
44
- 'cal ga ry',
45
- 'tor na do',
46
- 'pen',
47
- 'stu dy',
48
- 'ja mai ca',
49
- 'tri ni dad',
50
- 'ca na da',
51
- 'i ran',
52
- 'i raq',
53
- 'sau di a ra bi a',
54
- 'clin ton',
55
- 'hub ris',
56
- 'tur key',
57
- 'cor si ca',
58
- 'dev iled',
59
- // 'horse',
60
- // 'chance',
61
- // 'peo ple'
62
- ]
63
-
64
- test('test length', function (t) {
65
- words.forEach(sep => {
66
- let str = sep.replace(/ /g, '')
67
- let doc = nlp(str)
68
- let have = doc.syllables()[0]
69
- let want = sep.split(/ /g)
70
- t.equal(have.length, want.length, str)
71
- })
72
- t.end()
73
- })