natural 5.2.4 → 6.0.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.
@@ -48,8 +48,9 @@ jobs:
48
48
  # Run Linter against code base #
49
49
  ################################
50
50
  - name: Lint Code Base
51
- uses: github/super-linter@v4
51
+ uses: github/super-linter/slim@v4
52
52
  env:
53
53
  VALIDATE_ALL_CODEBASE: false
54
54
  DEFAULT_BRANCH: master
55
55
  GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
56
+ LINTER_RULES_PATH: /
@@ -0,0 +1,55 @@
1
+ /*
2
+ Copyright (c) 2022,
3
+ Hugo W.L. ter Doest <https://github.com/Hugo-ter-Doest>
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
13
+ all 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
21
+ THE SOFTWARE.
22
+ */
23
+
24
+ export declare interface TaggedWord {
25
+ [key: string]: string
26
+ token: string
27
+ pos: string
28
+ spos?: string
29
+ added?: boolean
30
+ }
31
+
32
+ export declare type PunctuationFunction = () => string[] | ''
33
+
34
+ export declare interface TaggedSentence {
35
+ tags: TaggedWord[]
36
+ punct?: PunctuationFunction
37
+ }
38
+
39
+ export declare type CallbackFunction = (obj: SentenceAnalyzer) => void
40
+
41
+ export declare type SenType = string
42
+
43
+ export declare class SentenceAnalyzer {
44
+ posObj: TaggedSentence
45
+ senType: string | null
46
+
47
+ constructor (pos: TaggedSentence, cbf: CallbackFunction)
48
+ part (cbf: CallbackFunction): void
49
+ prepositionPhrases (): void
50
+ subjectToString (): string | null
51
+ predicateToString (): string | null
52
+ implicitYou (): boolean
53
+ toString (): string
54
+ type (cbf: CallbackFunction): SenType
55
+ }
@@ -149,7 +149,9 @@ Sentences.prototype.type = function (cbf) {
149
149
 
150
150
  // FIXME - punct seems useless
151
151
  let lastElement = this.posObj.punct()
152
+ // console.log(lastElement)
152
153
  lastElement = (lastElement.length !== 0) ? lastElement.pop() : this.posObj.tags.pop()
154
+ // console.log(lastElement)
153
155
 
154
156
  if (lastElement.pos !== '.') {
155
157
  if (implicitYou) {
@@ -0,0 +1,73 @@
1
+ /*
2
+ Copyright (c) 2022,
3
+ Dylan R. E. Moonfire <https://github.com/dmoonfire>,
4
+ Emily Marigold Klassen <https://github.com/forivall>,
5
+ Hugo W.L. ter Doest <https://github.com/Hugo-ter-Doest>
6
+
7
+ Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ of this software and associated documentation files (the "Software"), to deal
9
+ in the Software without restriction, including without limitation the rights
10
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ copies of the Software, and to permit persons to whom the Software is
12
+ furnished to do so, subject to the following conditions:
13
+
14
+ The above copyright notice and this permission notice shall be included in
15
+ all copies or substantial portions of the Software.
16
+
17
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
+ THE SOFTWARE.
24
+ */
25
+
26
+ export declare class Predicate {
27
+ constructor (name: string, parameter1: string, parameter2?: string)
28
+ name: string
29
+ parameter1: string
30
+ parameter2?: string | undefined
31
+ function?: ((tagged_sentence: string[][], i: number, parameter: string) => boolean) | undefined
32
+ evaluate (taggedSentence: string[][], position: number): boolean
33
+ }
34
+
35
+ export declare class TransformationRule {
36
+ constructor (c1: string, c2: string, predicate: string, parameter1: string, parameter2?: string)
37
+ literal: string[]
38
+ predicate: Predicate
39
+ old_category: string
40
+ new_category: string
41
+ apply (taggedSentence: string[][], position: number): void
42
+ }
43
+
44
+ export declare class RuleSet {
45
+ constructor (filename: string)
46
+ rules: TransformationRule[]
47
+ }
48
+
49
+ export declare class Lexicon {
50
+ constructor (filename: string, defaultCategory: string)
51
+ defaultCategory: string
52
+ parseLexicon (data: string): void
53
+ tagWord (word: string): string[]
54
+ }
55
+
56
+ export interface TaggedWord {
57
+ token: string
58
+ tag: string
59
+ }
60
+
61
+ export declare class Sentence {
62
+ constructor (data?: string[])
63
+ taggedWords: TaggedWord[]
64
+ addTaggedWord (token: string, tag: string): void
65
+ clone (): Sentence
66
+ }
67
+
68
+ export declare class BrillPOSTagger {
69
+ constructor (lexicon: Lexicon, ruleSet: RuleSet)
70
+ lexicon: Lexicon
71
+ ruleSet: RuleSet
72
+ tag (sentence: string[]): Sentence
73
+ }
@@ -0,0 +1,135 @@
1
+
2
+ export interface BayesClassifierClassification {
3
+ label: string
4
+ value: number
5
+ }
6
+
7
+ export type BayesClassifierCallback = (err: any, classifier: BayesClassifier) => void
8
+
9
+ declare class BayesClassifier {
10
+ events: events.EventEmitter
11
+
12
+ constructor (stem?: Stemmer)
13
+ addDocument (text: string, stem: string): void
14
+ addDocument (text: string[], stem: string): void
15
+ train (): void
16
+ classify (observation: string): string
17
+ getClassifications (observation: string): BayesClassifierClassification[]
18
+ save (filename: string, callback: BayesClassifierCallback): void
19
+ static load (filename: string, stemmer: Stemmer, callback: BayesClassifierCallback): void
20
+ static restore (classifier: any, stemmer?: Stemmer): BayesClassifier
21
+ }
22
+
23
+ interface LogisticRegressionClassifierClassification {
24
+ label: string
25
+ value: number
26
+ }
27
+
28
+ export type LogisticRegressionCallback = (err: any, result: LogisticRegressionClassifier) => void
29
+
30
+ declare class LogisticRegressionClassifier {
31
+ events: events.EventEmitter
32
+
33
+ addDocument (text: string, stem: string): void
34
+ addDocument (text: string[], stem: string): void
35
+ train (): void
36
+ classify (observation: string): string
37
+ getClassifications (observation: string): LogisticRegressionClassifierClassification[]
38
+ save (filename: string, callback: LogisticRegressionCallback): void
39
+ static load (filename: string, stemmer: Stemmer, callback: LogisticRegressionCallback): void
40
+ static restore (classifier: any, stemmer?: Stemmer): LogisticRegressionClassifier
41
+ }
42
+
43
+ export type MaxEntClassifierCallback = (err: any, result: MaxEntClassifier) => void
44
+
45
+ declare class MaxEntClassifier {
46
+ sample: Sample
47
+ features: FeatureSet
48
+
49
+ constructor (features: FeatureSet, sample: Sample)
50
+ addElement (x: Element): void
51
+ addDocument (context: Context, classification: string, elementClass: Element): void
52
+ train (maxIterations: number, minImprovement: number, approxExpectation: object): void
53
+ getClassifications (b: Context): array
54
+ classify (b: Context): string
55
+ save (filename: string, callback: MaxEntClassifierCallback): void
56
+ static load (filename: string, elementClass: Element, callback: MaxEntClassifierCallback): void
57
+ }
58
+
59
+ export type FeatureFunction = (x: Element) => number
60
+
61
+ declare class Feature {
62
+ evaluate: FeatureFunction
63
+ name: string
64
+ parameters: array
65
+
66
+ constructor (f: FeatureFunction, name: string, parameters: array)
67
+ apply (x: Element): number
68
+ expectationApprox (p: Distribution, sample: Sample): number
69
+ expectation (p: Distribution, A: array, B: array): number
70
+ observedExpectation (sample: Sample): number
71
+ }
72
+
73
+ declare class FeatureSet {
74
+ features: array
75
+ map: object
76
+
77
+ addFeature (feature: FeatureFunction): boolean
78
+ featureExists (feature: FeatureFunction): boolean
79
+ getFeatures (): array
80
+ size (): number
81
+ prettyPrint (): string
82
+ }
83
+
84
+ export type SampleCallback = (err: any, result: Sample) => void
85
+
86
+ declare class Sample {
87
+ frequencyOfContext: object
88
+ frequency: object
89
+ classes: array
90
+
91
+ constructor (elements)
92
+ analyse (): void
93
+ addElement (x: Element): void
94
+ observedProbabilityOfContext (context: Context): number
95
+ observedProbability (x): number
96
+ size (): number
97
+ getClasses (): array
98
+ generateFeatures (featureSet: FeatureSet): void
99
+ save (filename: string, callback: SampleCallback): void
100
+ load (filename: string, elementClass: Element, callback: SampleCallback): void
101
+ }
102
+
103
+ declare class Context {
104
+ toString (): string
105
+ }
106
+
107
+ declare class Element {
108
+ constructor (a: any, b: Context)
109
+ key (): string
110
+ }
111
+
112
+ declare class SEElement extends Element {
113
+ generateFeatures (featureSet: FeatureSet): void
114
+ }
115
+
116
+ declare class POSElement extends Element {
117
+ generateFeatures (featureSet: FeatureSet): void
118
+ }
119
+
120
+ declare class GISScaler {
121
+ constructor (featureSet: FeatureSet, sample: Sample)
122
+ calculateMaxSumOfFeatures (): void
123
+ addCorrectionFeature (): void
124
+ run (maxIterations: number, minImprovement: number): Distribution
125
+ }
126
+
127
+ declare class MESentence {
128
+ constructor (data: array): void
129
+ generateSampleElements (sample: Sample): void
130
+ }
131
+
132
+ declare class MECorpus {
133
+ generateSample (): Sample
134
+ splitInTrainAndTest (percentageTrain: number): array
135
+ }
@@ -76,6 +76,7 @@ Classifier.prototype.save = function (filename, callback) {
76
76
  const classifier = this
77
77
  fs.writeFile(filename, data, 'utf8', function (err) {
78
78
  if (callback) {
79
+ console.log('Saved classifier to ' + filename)
79
80
  callback(err, err ? null : classifier)
80
81
  }
81
82
  })
@@ -62,7 +62,7 @@ Feature.prototype.expectationApprox = function (p, sample) {
62
62
  return sum
63
63
  }
64
64
 
65
- // Diect calculation of expected value of this feature according to distribution p
65
+ // Direct calculation of expected value of this feature according to distribution p
66
66
  // In real-life applications with a lot of features this is not tractable
67
67
  Feature.prototype.expectation = function (p, A, B) {
68
68
  let sum = 0
@@ -0,0 +1,76 @@
1
+
2
+ /*
3
+ Copyright (c) 2022, Dylan R. E. Moonfire <https://github.com/dmoonfire>, Emily Marigold Klassen <https://github.com/forivall>, Hugo W.L. ter Doest
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
13
+ all 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
21
+ THE SOFTWARE.
22
+ */
23
+
24
+ // Based on type definitions on Definitely Typed
25
+
26
+ export interface JaroWinklerOptions {
27
+ dj?: number | undefined
28
+ // default: false
29
+ ignoreCase?: boolean | undefined
30
+ }
31
+ export declare function JaroWinklerDistance (s1: string, s2: string, options: JaroWinklerOptions): number
32
+
33
+ export interface DamerauLevenshteinDistanceOptions {
34
+ /** @default 1 */
35
+ insertion_cost?: number | undefined
36
+ /** @default 1 */
37
+ deletion_cost?: number | undefined
38
+ /** @default 1 */
39
+ substitution_cost?: number | undefined
40
+ /** @default 1 */
41
+ transposition_cost?: number | undefined
42
+ /** @default false */
43
+ search?: boolean | undefined
44
+ /** @default false */
45
+ restricted?: boolean | undefined
46
+ damerau?: boolean | undefined
47
+ }
48
+ interface SubstringDistanceResult {
49
+ substring: string
50
+ distance: number
51
+ }
52
+ export declare function LevenshteinDistance (source: string, target: string, options?: DamerauLevenshteinDistanceOptions): number
53
+ /**
54
+ * Returns the Damerau-Levenshtein distance between strings. Counts the distance
55
+ * between two strings by returning the number of edit operations required to
56
+ * convert `source` into `target`.
57
+ *
58
+ * Valid edit operations are:
59
+ * - transposition, insertion, deletion, and substitution
60
+ */
61
+ export function DamerauLevenshteinDistance (
62
+ source: string,
63
+ target: string,
64
+ options: DamerauLevenshteinDistanceOptions & { search: true }
65
+ ): SubstringDistanceResult
66
+ export function DamerauLevenshteinDistance (
67
+ source: string,
68
+ target: string,
69
+ options?: DamerauLevenshteinDistanceOptions & { search?: false | undefined }
70
+ ): number
71
+ export function DamerauLevenshteinDistance (
72
+ source: string,
73
+ target: string,
74
+ options: DamerauLevenshteinDistanceOptions & { search: boolean }
75
+ ): number | SubstringDistanceResult
76
+ export declare function DiceCoefficient (str1: string, str2: string): number
@@ -102,19 +102,17 @@ function distance (s1, s2) {
102
102
  // s2 is the second string to compare
103
103
  // dj is the Jaro Distance (if you've already computed it), leave blank and the method handles it
104
104
  // ignoreCase: if true strings are first converted to lower case before comparison
105
- function JaroWinklerDistance (s1, s2, dj, ignoreCase) {
105
+ function JaroWinklerDistance (s1, s2, options) {
106
106
  if (s1 === s2) {
107
107
  return 1
108
108
  } else {
109
- if (ignoreCase) {
109
+ if (options.ignoreCase) {
110
110
  s1 = s1.toLowerCase()
111
111
  s2 = s2.toLowerCase()
112
112
  }
113
113
 
114
- // console.log(news1);
115
- // console.log(news2);
116
-
117
- const jaro = (typeof (dj) === 'undefined') ? distance(s1, s2) : dj
114
+ // Use the Jaro distance provided by the client if present
115
+ const jaro = (options.dj === undefined) ? distance(s1, s2) : options.dj
118
116
  const p = 0.1 // default scaling factor
119
117
  let l = 0 // length of the matching prefix
120
118
  while (s1[l] === s2[l] && l < 4) {
@@ -89,6 +89,7 @@ function getMinCostSubstring (distanceMatrix, source, target) {
89
89
  * transposition_cost: number (default: 1)
90
90
  * search: boolean (default: false)
91
91
  * restricted: boolean (default: false)
92
+ * damerau: boolean (depends on the function called)
92
93
  */
93
94
  function DamerauLevenshteinDistance (source, target, options) {
94
95
  const damLevOptions = _.extend(
@@ -0,0 +1,39 @@
1
+ /*
2
+ Copyright (c) 2022,
3
+ Hugo W.L. ter Doest <https://github.com/Hugo-ter-Doest>
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
13
+ all 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
21
+ THE SOFTWARE.
22
+ */
23
+
24
+ export * from './analyzers'
25
+ export * from './brill_pos_tagger'
26
+ export * from './classifiers'
27
+ export * from './distance'
28
+ export * from './inflectors'
29
+ export * from './ngrams'
30
+ export * from './normalizers'
31
+ export * from './phonetics'
32
+ export * from './sentiment'
33
+ export * from './spelcheck'
34
+ export * from './stemmers'
35
+ export * from './tfidf'
36
+ export * from './tokenizers'
37
+ export * from './transliterators'
38
+ export * from './util'
39
+ export * from './wordnet'
@@ -0,0 +1,35 @@
1
+ /*
2
+ Copyright (c) 2022, Dylan R. E. Moonfire <https://github.com/dmoonfire>, Emily Marigold Klassen <https://github.com/forivall>, Hugo W.L. ter Doest
3
+
4
+ Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ of this software and associated documentation files (the "Software"), to deal
6
+ in the Software without restriction, including without limitation the rights
7
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ copies of the Software, and to permit persons to whom the Software is
9
+ furnished to do so, subject to the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be included in
12
+ all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20
+ THE SOFTWARE.
21
+ */
22
+
23
+ export declare class NounInflector {
24
+ pluralize (token: string): string
25
+ singularize (token: string): string
26
+ }
27
+
28
+ export declare let CountInflector: {
29
+ nth: (i: number) => string
30
+ }
31
+
32
+ export declare class PresentVerbInflector {
33
+ pluralize (token: string): string
34
+ singularize (token: string): string
35
+ }
@@ -0,0 +1,35 @@
1
+ /*
2
+ Copyright (c) 2022, Dylan R. E. Moonfire <https://github.com/dmoonfire>,
3
+ Emily Marigold Klassen <https://github.com/forivall>,
4
+ Hugo W.L. ter Doest <https://github.com/Hugo-ter-Doest>
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ of this software and associated documentation files (the "Software"), to deal
8
+ in the Software without restriction, including without limitation the rights
9
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ copies of the Software, and to permit persons to whom the Software is
11
+ furnished to do so, subject to the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be included in
14
+ all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22
+ THE SOFTWARE.
23
+ */
24
+
25
+ declare interface ngramsFunctions {
26
+ bigrams: (sequence: string | string[], startSymbol?: string, endSymbol?: string) => string[][]
27
+ // bigrams: (sequence: string[], startSymbol?: string, endSymbol?: string) => string[][]
28
+ trigrams: (sequence: string | string[], startSymbol?: string, endSymbol?: string) => string[][]
29
+ // trigrams: (sequence: string[], startSymbol?: string, endSymbol?: string) => string[][]
30
+ ngrams: (sequence: string | string[], n: number, startSymbol?: string, endSymbol?: string) => string[][]
31
+ // ngrams: (sequence: string[], n: number, startSymbol?: string, endSymbol?: string) => string[][]
32
+ }
33
+
34
+ export declare let NGrams: ngramsFunctions
35
+ export declare let NGramsZH: ngramsFunctions
@@ -0,0 +1,41 @@
1
+ /*
2
+ Copyright (c) 2022, Dylan R. E. Moonfire <https://github.com/dmoonfire>, Emily Marigold Klassen <https://github.com/forivall>, Hugo W.L. ter Doest
3
+
4
+ Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ of this software and associated documentation files (the "Software"), to deal
6
+ in the Software without restriction, including without limitation the rights
7
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ copies of the Software, and to permit persons to whom the Software is
9
+ furnished to do so, subject to the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be included in
12
+ all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20
+ THE SOFTWARE.
21
+ */
22
+
23
+ export interface Phonetic {
24
+ compare: (stringA: string, stringB: string) => boolean
25
+ process: (token: string, maxLength?: number) => string
26
+ }
27
+
28
+ declare let Metaphone: {
29
+ compare: (stringA: string, stringB: string) => boolean
30
+ process: (token: string, maxLength?: number) => string
31
+ }
32
+
33
+ declare let SoundEx: {
34
+ compare: (stringA: string, stringB: string) => boolean
35
+ process: (token: string, maxLength?: number) => string
36
+ }
37
+
38
+ declare let DoubleMetaphone: {
39
+ compare: (stringA: string, stringB: string) => boolean
40
+ process: (token: string, maxLength?: number) => string[]
41
+ }
@@ -0,0 +1,27 @@
1
+
2
+ /*
3
+ Copyright (c) 2022, Dylan R. E. Moonfire <https://github.com/dmoonfire>, Emily Marigold Klassen <https://github.com/forivall>, Hugo W.L. ter Doest
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
13
+ all 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
21
+ THE SOFTWARE.
22
+ */
23
+
24
+ export declare class SentimentAnalyzer {
25
+ constructor (language: string, stemmer: Stemmer, vocabulary: string)
26
+ getSentiment (words: string[]): number
27
+ }
@@ -0,0 +1,30 @@
1
+ /*
2
+ Copyright (c) 2022,
3
+ Dylan R. E. Moonfire <https://github.com/dmoonfire>,
4
+ Emily Marigold Klassen <https://github.com/forivall>,
5
+ Hugo W.L. ter Doest <https://github.com/Hugo-ter-Doest>
6
+
7
+ Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ of this software and associated documentation files (the "Software"), to deal
9
+ in the Software without restriction, including without limitation the rights
10
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ copies of the Software, and to permit persons to whom the Software is
12
+ furnished to do so, subject to the following conditions:
13
+
14
+ The above copyright notice and this permission notice shall be included in
15
+ all copies or substantial portions of the Software.
16
+
17
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
+ THE SOFTWARE.
24
+ */
25
+
26
+ export declare class Spellcheck {
27
+ constructor (wordlist: string[])
28
+ isCorrect (word: string): boolean
29
+ getCorrections (word: string, maxDistance?: number): string[]
30
+ }
@@ -0,0 +1,44 @@
1
+ /*
2
+ Copyright (c) 2022, Dylan R. E. Moonfire <https://github.com/dmoonfire>, Emily Marigold Klassen <https://github.com/forivall>, Hugo W.L. ter Doest
3
+
4
+ Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ of this software and associated documentation files (the "Software"), to deal
6
+ in the Software without restriction, including without limitation the rights
7
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ copies of the Software, and to permit persons to whom the Software is
9
+ furnished to do so, subject to the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be included in
12
+ all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20
+ THE SOFTWARE.
21
+ */
22
+
23
+ // Based on the type definitions on definitely typed
24
+
25
+ export interface Stemmer {
26
+ stem: (token: string) => string
27
+ tokenizeAndStem: (text: string) => string[]
28
+ attach: () => void
29
+ }
30
+
31
+ declare const CarryStemmerFr: Stemmer
32
+ declare const LancasterStemmer: Stemmer
33
+ declare const PorterStemmer: Stemmer
34
+ declare const PorterStemmerEs: Stemmer
35
+ declare const PorterStemmerFa: Stemmer
36
+ declare const PorterStemmerFr: Stemmer
37
+ declare const PorterStemmerIt: Stemmer
38
+ declare const PorterStemmerNl: Stemmer
39
+ declare const PorterStemmerNo: Stemmer
40
+ declare const PorterStemmerPt: Stemmer
41
+ declare const PorterStemmerRu: Stemmer
42
+ declare const PorterStemmerSv: Stemmer
43
+ declare const StemmerId: Stemmer
44
+ declare const StemmerJa: Stemmer
@@ -0,0 +1,42 @@
1
+ /*
2
+ Copyright (c) 2022,
3
+ Dylan R. E. Moonfire <https://github.com/dmoonfire>,
4
+ Emily Marigold Klassen <https://github.com/forivall>,
5
+ Hugo W.L. ter Doest <https://github.com/Hugo-ter-Doest>
6
+
7
+ Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ of this software and associated documentation files (the "Software"), to deal
9
+ in the Software without restriction, including without limitation the rights
10
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ copies of the Software, and to permit persons to whom the Software is
12
+ furnished to do so, subject to the following conditions:
13
+
14
+ The above copyright notice and this permission notice shall be included in
15
+ all copies or substantial portions of the Software.
16
+
17
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
+ THE SOFTWARE.
24
+ */
25
+
26
+ export type TfIdfCallback = (i: number, measure: number) => void
27
+
28
+ export interface TfIdfTerm {
29
+ term: string
30
+ tfidf: number
31
+ }
32
+
33
+ export declare class TfIdf {
34
+ constructor (deserialized?: any)
35
+ addDocument (document: string, key?: string, restoreCache?: boolean): void
36
+ addDocument (document: string[], key?: string, restoreCache?: boolean): void
37
+ addFileSync (path: string, encoding?: string, key?: string, restoreCache?: boolean): void
38
+ tfidf (terms: string, d: number): void
39
+ tfidfs (terms: string, callback: TfIdfCallback): void
40
+ tfidfs (terms: string[], callback: TfIdfCallback): void
41
+ listTerms (d: number): TfIdfTerm[]
42
+ }
@@ -0,0 +1,99 @@
1
+ /*
2
+ Copyright (c) 2022, Dylan R. E. Moonfire <https://github.com/dmoonfire>, Emily Marigold Klassen <https://github.com/forivall>, Hugo W.L. ter Doest
3
+
4
+ Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ of this software and associated documentation files (the "Software"), to deal
6
+ in the Software without restriction, including without limitation the rights
7
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ copies of the Software, and to permit persons to whom the Software is
9
+ furnished to do so, subject to the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be included in
12
+ all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20
+ THE SOFTWARE.
21
+ */
22
+
23
+ // Based on type definitions on Definitely Typed
24
+
25
+ export interface Tokenizer {
26
+ tokenize: (text: string) => string[]
27
+ }
28
+ export declare class WordTokenizer implements Tokenizer {
29
+ tokenize (text: string): string[]
30
+ }
31
+ export declare class TreebankWordTokenizer implements Tokenizer {
32
+ tokenize (text: string): string[]
33
+ }
34
+ export interface RegexTokenizerOptions {
35
+ pattern?: RegExp | undefined
36
+ discardEmpty?: boolean | undefined
37
+ }
38
+ export declare class RegexpTokenizer implements Tokenizer {
39
+ constructor (options: RegexTokenizerOptions)
40
+ tokenize (text: string): string[];
41
+ }
42
+ export declare class OrthographyTokenizer implements Tokenizer {
43
+ constructor (options: RegexTokenizerOptions & { language: string })
44
+ tokenize (text: string): string[]
45
+ }
46
+ export declare class WordPunctTokenizer implements Tokenizer {
47
+ tokenize (text: string): string[]
48
+ }
49
+ export declare class SentenceTokenizer implements Tokenizer {
50
+ tokenize (text: string): string[]
51
+ }
52
+ export declare class SentenceTokenizerNew implements Tokenizer {
53
+ tokenize (text: string): string[]
54
+ }
55
+ export declare class CaseTokenizer implements Tokenizer {
56
+ tokenize (text: string, preserveApostrophy?: boolean): string[]
57
+ }
58
+ export declare class AggressiveTokenizer implements Tokenizer {
59
+ tokenize (text: string): string[]
60
+ }
61
+ export declare class AggressiveTokenizerEs implements Tokenizer {
62
+ tokenize (text: string): string[]
63
+ }
64
+ export declare class AggressiveTokenizerFa implements Tokenizer {
65
+ tokenize (text: string): string[]
66
+ }
67
+ export declare class AggressiveTokenizerFr implements Tokenizer {
68
+ tokenize (text: string): string[]
69
+ }
70
+ export declare class AggressiveTokenizerId implements Tokenizer {
71
+ tokenize (text: string): string[]
72
+ }
73
+ export declare class AggressiveTokenizerIt implements Tokenizer {
74
+ tokenize (text: string): string[]
75
+ }
76
+ export declare class AggressiveTokenizerNl implements Tokenizer {
77
+ tokenize (text: string): string[]
78
+ }
79
+ export declare class AggressiveTokenizerNo implements Tokenizer {
80
+ tokenize (text: string): string[]
81
+ }
82
+ export declare class AggressiveTokenizerPl implements Tokenizer {
83
+ tokenize (text: string): string[]
84
+ }
85
+ export declare class AggressiveTokenizerPt implements Tokenizer {
86
+ tokenize (text: string): string[]
87
+ }
88
+ export declare class AggressiveTokenizerRu implements Tokenizer {
89
+ tokenize (text: string): string[]
90
+ }
91
+ export declare class AggressiveTokenizerSv implements Tokenizer {
92
+ tokenize (text: string): string[]
93
+ }
94
+ export declare class AggressiveTokenizerVi implements Tokenizer {
95
+ tokenize (text: string): string[]
96
+ }
97
+ export declare class TokenizerJa implements Tokenizer {
98
+ tokenize (text: string): string[]
99
+ }
@@ -0,0 +1,27 @@
1
+ /*
2
+ Copyright (c) 2022,
3
+ Hugo W.L. ter Doest <https://github.com/Hugo-ter-Doest>
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
13
+ all 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
21
+ THE SOFTWARE.
22
+ */
23
+
24
+ // First define a function type for transliterators ...
25
+ export declare type TransliteratorFunction = (s: string) => string
26
+ // and then export the Japanese transliterator as a function of that type
27
+ export declare let TransliterateJa: TransliteratorFunction
@@ -22,4 +22,4 @@ THE SOFTWARE.
22
22
 
23
23
  'use strict'
24
24
 
25
- exports.transliterate_ja = require('./ja')
25
+ exports.TransliterateJa = require('./ja')
@@ -0,0 +1,33 @@
1
+ /*
2
+ Copyright (c) 2022, Dylan R. E. Moonfire <https://github.com/dmoonfire>,
3
+ Emily Marigold Klassen <https://github.com/forivall>,
4
+ Hugo W.L. ter Doest <https://github.com/Hugo-ter-Doest>
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ of this software and associated documentation files (the "Software"), to deal
8
+ in the Software without restriction, including without limitation the rights
9
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ copies of the Software, and to permit persons to whom the Software is
11
+ furnished to do so, subject to the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be included in
14
+ all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22
+ THE SOFTWARE.
23
+ */
24
+
25
+ export declare class Trie {
26
+ constructor (caseSensitive?: boolean)
27
+ addString (text: string): boolean
28
+ addStrings (strings: string[]): void
29
+ contains (token: string): boolean
30
+ findPrefix (text: string): string[]
31
+ findMatchesOnPath (text: string): string[]
32
+ keysWithPrefix (text: string): string[]
33
+ }
@@ -0,0 +1,44 @@
1
+ /*
2
+ Copyright (c) 2022,
3
+ Dylan R. E. Moonfire <https://github.com/dmoonfire>,
4
+ Emily Marigold Klassen <https://github.com/forivall>,
5
+ Hugo W.L. ter Doest <https://github.com/Hugo-ter-Doest>
6
+
7
+ Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ of this software and associated documentation files (the "Software"), to deal
9
+ in the Software without restriction, including without limitation the rights
10
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ copies of the Software, and to permit persons to whom the Software is
12
+ furnished to do so, subject to the following conditions:
13
+
14
+ The above copyright notice and this permission notice shall be included in
15
+ all copies or substantial portions of the Software.
16
+
17
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
+ THE SOFTWARE.
24
+ */
25
+
26
+ export declare class EdgeWeightedDigraph {
27
+ add (start: number, end: number, weight: number): void
28
+ v (): number
29
+ e (): number
30
+ }
31
+
32
+ export declare class ShortestPathTree {
33
+ constructor (diagraph: EdgeWeightedDigraph, startVertex: number)
34
+ getDistTo (vertex: number): number
35
+ hasPathTo (vertex: number): boolean
36
+ pathTo (vertex: number): number[]
37
+ }
38
+
39
+ export declare class LongestPathTree {
40
+ constructor (diagraph: EdgeWeightedDigraph, startVertex: number)
41
+ getDistTo (vertex: number): number
42
+ hasPathTo (vertex: number): boolean
43
+ pathTo (vertex: number): number[]
44
+ }
@@ -0,0 +1,42 @@
1
+ /*
2
+ Copyright (c) 2022,
3
+ Dylan R. E. Moonfire <https://github.com/dmoonfire>,
4
+ Emily Marigold Klassen <https://github.com/forivall>,
5
+ Hugo W.L. ter Doest <https://github.com/Hugo-ter-Doest>
6
+
7
+ Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ of this software and associated documentation files (the "Software"), to deal
9
+ in the Software without restriction, including without limitation the rights
10
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ copies of the Software, and to permit persons to whom the Software is
12
+ furnished to do so, subject to the following conditions:
13
+
14
+ The above copyright notice and this permission notice shall be included in
15
+ all copies or substantial portions of the Software.
16
+
17
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
+ THE SOFTWARE.
24
+ */
25
+
26
+ export interface WordNetLookupResults {
27
+ synsetOffset: number
28
+ pos: string
29
+ lemma: string
30
+ synonyms: string[]
31
+ gloss: string
32
+ }
33
+
34
+ export type WordNetLookupCallback = (results: WordNetLookupResults[]) => void
35
+
36
+ export type WordNetGetCallback = (results: WordNetLookupResults) => void
37
+
38
+ export declare class WordNet {
39
+ constructor (filename?: string)
40
+ lookup (word: string, callback: WordNetLookupCallback): void
41
+ get (synsetOffset: number, pos: string, callback: WordNetGetCallback): void
42
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "natural",
3
3
  "description": "General natural language (tokenizing, stemming (English, Russian, Spanish), part-of-speech tagging, sentiment analysis, classification, inflection, phonetics, tfidf, WordNet, jaro-winkler, Levenshtein distance, Dice's Coefficient) facilities for node.",
4
- "version": "5.2.4",
4
+ "version": "6.0.0",
5
5
  "homepage": "https://github.com/NaturalNode/natural",
6
6
  "repository": {
7
7
  "type": "git",
@@ -15,6 +15,7 @@
15
15
  "apparatus": "^0.0.10",
16
16
  "safe-stable-stringify": "^2.2.0",
17
17
  "sylvester": "^0.0.12",
18
+ "tsc": "^2.0.4",
18
19
  "underscore": "^1.9.1",
19
20
  "wordnet-db": "^3.1.11"
20
21
  },
@@ -57,7 +58,8 @@
57
58
  "test": "NODE_PATH=. node ./node_modules/jasmine/bin/jasmine.js io_spec/*_spec.js spec/*_spec.js",
58
59
  "coverage": "nyc --reporter=lcov npm test",
59
60
  "test_io": "NODE_PATH=. node ./node_modules/jasmine/bin/jasmine.js --random=false io_spec/*_spec.js",
60
- "test_browser": "NODE_PATH=. node ./node_modules/gulp/bin/gulp.js"
61
+ "test_browser": "NODE_PATH=. node ./node_modules/gulp/bin/gulp.js",
62
+ "lint": "eslint . --ext .ts"
61
63
  },
62
64
  "license": "MIT",
63
65
  "author": "Chris Umbel <chris@chrisumbel.com>",
package/tsconfig.json CHANGED
@@ -1,23 +1,25 @@
1
1
  {
2
- "compilerOptions": {
3
- "module": "commonjs",
4
- "lib": [
5
- "es6"
6
- ],
7
- "noImplicitAny": true,
8
- "noImplicitThis": true,
9
- "strictNullChecks": false,
10
- "strictFunctionTypes": true,
11
- "baseUrl": "../",
12
- "typeRoots": [
13
- "../"
14
- ],
15
- "types": [],
16
- "noEmit": true,
17
- "forceConsistentCasingInFileNames": true
18
- },
19
- "include": ["./lib/natural/**/*"],
20
- "files": [
21
- "tokenizers.d.ts"
22
- ]
2
+ "compilerOptions": {
3
+ "target": "es6",
4
+ "resolveJsonModule": true,
5
+ "lib": [
6
+ "es6"
7
+ ],
8
+ "module": "commonjs",
9
+ "rootDir": "./",
10
+ "moduleResolution": "node",
11
+ "allowJs": true,
12
+ "outDir": "./dist",
13
+ "esModuleInterop": true,
14
+ "forceConsistentCasingInFileNames": true,
15
+ "strict": true,
16
+ "skipLibCheck": true
17
+ },
18
+ "include": [
19
+ "lib/natural/**/*",
20
+ "spec/*"
21
+ ],
22
+ "exclude": [
23
+ "./node_modules"
24
+ ]
23
25
  }