@nodef/extra-english 0.0.0-stage → 1.1.0
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/LICENSE +21 -0
- package/README.md +74 -2
- package/deno.lock +39 -0
- package/index.d.ts +44 -0
- package/index.js +1328 -0
- package/index.test.ts +63 -0
- package/package.json +12 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2018-26 Subhajit Sahu
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,75 @@
|
|
|
1
|
-
|
|
1
|
+
[English] is a West Germanic language, first spoken in early medieval England. This package is a collection of various English language utilities. It includes functions for converting text to phonetic representations and stemming words.
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[English]: https://en.wikipedia.org/wiki/English_language
|
|
4
|
+
|
|
5
|
+
▌
|
|
6
|
+
📦 [JSR](https://jsr.io/@nodef/extra-english),
|
|
7
|
+
📦 [NPM](https://www.npmjs.com/package/@nodef/extra-english),
|
|
8
|
+
📰 [Docs](https://jsr.io/@nodef/extra-english/doc).
|
|
9
|
+
|
|
10
|
+
<br>
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
import * as xenglish from "jsr:@nodef/extra-english";
|
|
15
|
+
|
|
16
|
+
//# Phonetic functions
|
|
17
|
+
xenglish.caverphonePhonetic('Thompson', true);
|
|
18
|
+
// → 'TMPSN1'
|
|
19
|
+
|
|
20
|
+
xenglish.colognePhonetic('Hari');
|
|
21
|
+
// → '7'
|
|
22
|
+
|
|
23
|
+
xenglish.metaphonePhonetic('Lightyear');
|
|
24
|
+
// → 'LHTYAR'
|
|
25
|
+
|
|
26
|
+
xenglish.mraPhonetic('Byrne');
|
|
27
|
+
// → 'BYRN'
|
|
28
|
+
|
|
29
|
+
xenglish.soundexPhonetic('Tymczak');
|
|
30
|
+
// → 'T522'
|
|
31
|
+
|
|
32
|
+
xenglish.soundexSqlPhonetic('Tymczak');
|
|
33
|
+
// → 'T520'
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
//# Stemming functions
|
|
37
|
+
xenglish.lancasterStem('running');
|
|
38
|
+
// → 'run'
|
|
39
|
+
|
|
40
|
+
xenglish.porterStem('running');
|
|
41
|
+
// → 'run'
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
### Index
|
|
46
|
+
|
|
47
|
+
| Name | Action
|
|
48
|
+
|------------------------------|-------
|
|
49
|
+
| [caverphonePhonetic] | Get Caverphone phonetic of English text.
|
|
50
|
+
| [colognePhonetic] | Get Cologne phonetic of English text.
|
|
51
|
+
| [metaphonePhonetic] | Get Metaphone phonetic of English text.
|
|
52
|
+
| [mraPhonetic] | Get Match Rating Approach phonetic of English text.
|
|
53
|
+
| [soundexPhonetic] | Get Soundex phonetic of English text.
|
|
54
|
+
| [soundexSqlPhonetic] | Get Soundex phonetic (SQL) of English text.
|
|
55
|
+
| [lancasterStem] | Stem a word to its base form using the Lancaster stemmer.
|
|
56
|
+
| [porterStem] | Stem a word to its base form using the Porter stemmer.
|
|
57
|
+
<!-- | [nysiisPhonetic] | Get NYSIIS phonetic of English text. -->
|
|
58
|
+
|
|
59
|
+
<br>
|
|
60
|
+
<br>
|
|
61
|
+
|
|
62
|
+
[](https://wolfram77.github.io)<br>
|
|
63
|
+
[](https://nodef.github.io)
|
|
64
|
+

|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
[caverphonePhonetic]: https://jsr.io/@nodef/extra-english/doc/~/caverphonePhonetic
|
|
68
|
+
[colognePhonetic]: https://jsr.io/@nodef/extra-english/doc/~/colognePhonetic
|
|
69
|
+
[metaphonePhonetic]: https://jsr.io/@nodef/extra-english/doc/~/metaphonePhonetic
|
|
70
|
+
[mraPhonetic]: https://jsr.io/@nodef/extra-english/doc/~/mraPhonetic
|
|
71
|
+
[nysiisPhonetic]: https://jsr.io/@nodef/extra-english/doc/~/nysiisPhonetic
|
|
72
|
+
[soundexPhonetic]: https://jsr.io/@nodef/extra-english/doc/~/soundexPhonetic
|
|
73
|
+
[soundexSqlPhonetic]: https://jsr.io/@nodef/extra-english/doc/~/soundexSqlPhonetic
|
|
74
|
+
[lancasterStem]: https://jsr.io/@nodef/extra-english/doc/~/lancasterStem
|
|
75
|
+
[porterStem]: https://jsr.io/@nodef/extra-english/doc/~/porterStem
|
package/deno.lock
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "5",
|
|
3
|
+
"specifiers": {
|
|
4
|
+
"jsr:@std/assert@*": "1.0.12",
|
|
5
|
+
"jsr:@std/assert@^1.0.19": "1.0.19",
|
|
6
|
+
"jsr:@std/cli@^1.0.32": "1.0.32",
|
|
7
|
+
"jsr:@std/internal@^1.0.12": "1.0.14",
|
|
8
|
+
"jsr:@std/internal@^1.0.6": "1.0.6"
|
|
9
|
+
},
|
|
10
|
+
"jsr": {
|
|
11
|
+
"@std/assert@1.0.12": {
|
|
12
|
+
"integrity": "08009f0926dda9cbd8bef3a35d3b6a4b964b0ab5c3e140a4e0351fbf34af5b9a",
|
|
13
|
+
"dependencies": [
|
|
14
|
+
"jsr:@std/internal@^1.0.6"
|
|
15
|
+
]
|
|
16
|
+
},
|
|
17
|
+
"@std/assert@1.0.19": {
|
|
18
|
+
"integrity": "eaada96ee120cb980bc47e040f82814d786fe8162ecc53c91d8df60b8755991e",
|
|
19
|
+
"dependencies": [
|
|
20
|
+
"jsr:@std/internal@^1.0.12"
|
|
21
|
+
]
|
|
22
|
+
},
|
|
23
|
+
"@std/cli@1.0.32": {
|
|
24
|
+
"integrity": "188b3a100d6202d64e3f5bd3d799c7fa4f6d77f92cc65eb7f641c1fa0aa92a66"
|
|
25
|
+
},
|
|
26
|
+
"@std/internal@1.0.6": {
|
|
27
|
+
"integrity": "9533b128f230f73bd209408bb07a4b12f8d4255ab2a4d22a1fd6d87304aca9a4"
|
|
28
|
+
},
|
|
29
|
+
"@std/internal@1.0.14": {
|
|
30
|
+
"integrity": "291516b3d4c35024d6ffbc0a9df5bf4c64116e05b50012cf846710152d2ffdf7"
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
"workspace": {
|
|
34
|
+
"dependencies": [
|
|
35
|
+
"jsr:@std/assert@^1.0.19",
|
|
36
|
+
"jsr:@std/cli@^1.0.32"
|
|
37
|
+
]
|
|
38
|
+
}
|
|
39
|
+
}
|
package/index.d.ts
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Get Caverphone phonetic of English text.
|
|
3
|
+
* @param txt english text
|
|
4
|
+
* @param ext extended caverphone? [false]
|
|
5
|
+
* @returns caverphone phonetic string
|
|
6
|
+
*/ export declare function caverphonePhonetic(txt: string, ext?: boolean): string;
|
|
7
|
+
/**
|
|
8
|
+
* Get Cologne phonetic of English text.
|
|
9
|
+
* @param txt english text
|
|
10
|
+
* @returns cologne phonetic string
|
|
11
|
+
*/ export declare function colognePhonetic(txt: string): string;
|
|
12
|
+
/**
|
|
13
|
+
* Get Metaphone phonetic of English text.
|
|
14
|
+
* @param txt english text
|
|
15
|
+
* @returns metaphone phonetic string
|
|
16
|
+
*/ export declare function metaphonePhonetic(txt: string): string;
|
|
17
|
+
/**
|
|
18
|
+
* Get Match Rating Approach (MRA) phonetic of English text.
|
|
19
|
+
* @param txt english text
|
|
20
|
+
* @param ext extended MRA? [false]
|
|
21
|
+
* @returns MRA phonetic string
|
|
22
|
+
*/ export declare function mraPhonetic(txt: string, ext?: boolean): string;
|
|
23
|
+
/**
|
|
24
|
+
* Get Soundex phonetic of English text.
|
|
25
|
+
* @param txt english text
|
|
26
|
+
* @param ext extended soundex? [false]
|
|
27
|
+
* @returns soundex phonetic string
|
|
28
|
+
*/ export declare function soundexPhonetic(txt: string, ext?: boolean): string;
|
|
29
|
+
/**
|
|
30
|
+
* Get Soundex phonetic (SQL) of English text.
|
|
31
|
+
* @param txt english text
|
|
32
|
+
* @param ext extended soundex? [false]
|
|
33
|
+
* @returns soundex phonetic (SQL) string
|
|
34
|
+
*/ export declare function soundexSqlPhonetic(txt: string, ext?: boolean): string;
|
|
35
|
+
/**
|
|
36
|
+
* Stem a word to its base form using the Lancaster stemmer.
|
|
37
|
+
* @param word word to be stemmed
|
|
38
|
+
* @returns stemmed word
|
|
39
|
+
*/ export declare function lancasterStem(word: string): string;
|
|
40
|
+
/**
|
|
41
|
+
* Stem a word to its base form using the Porter stemmer.
|
|
42
|
+
* @param word word to be stemmed
|
|
43
|
+
* @returns stemmed word
|
|
44
|
+
*/ export declare function porterStem(word: string): string;
|