natural 6.5.1 → 6.7.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.
@@ -44,12 +44,14 @@ const dutchPatternVoca = require('./Dutch/pattern-sentiment-nl.json')
44
44
  const italianPatternVoca = require('./Italian/pattern-sentiment-it.json')
45
45
  const englishPatternVoca = require('./English/pattern-sentiment-en.json')
46
46
  const frenchPatternVoca = require('./French/pattern-sentiment-fr.json')
47
+ const germanPatternVoca = require('./German/pattern-sentiment-de.json')
47
48
 
48
49
  // Negations
49
50
  const englishNegations = require('./English/negations_en.json').words
50
51
  const spanishNegations = require('./Spanish/negations_es.json').words
51
52
  const dutchNegations = require('./Dutch/negations_du.json').words
52
53
  const portugueseNegations = require('./Portuguese/negations_pt.json').words
54
+ const germanNegations = require('./German/negations_de.json').words
53
55
 
54
56
  // Mapping from type of vocabulary to language to vocabulary
55
57
  const languageFiles = {
@@ -72,7 +74,8 @@ const languageFiles = {
72
74
  Dutch: [dutchPatternVoca, dutchNegations],
73
75
  Italian: [italianPatternVoca, null],
74
76
  English: [englishPatternVoca, englishNegations],
75
- French: [frenchPatternVoca, null]
77
+ French: [frenchPatternVoca, null],
78
+ German: [germanPatternVoca, germanNegations]
76
79
  }
77
80
  }
78
81
 
@@ -30,7 +30,7 @@ export type SenticonLanguageType = 'senticon'
30
30
  export type SenticonLanguage = 'Spanish' | 'English' | 'Galician' | 'Catalan' | 'Basque'
31
31
 
32
32
  export type PatternLanguageType = 'pattern'
33
- export type PatternLanguage = 'Dutch' | 'Italian' | 'English' | 'French'
33
+ export type PatternLanguage = 'Dutch' | 'Italian' | 'English' | 'French' | 'German'
34
34
 
35
35
  export declare class SentimentAnalyzer {
36
36
  constructor (language: AfinnLanguage, stemmer: Stemmer, type: AfinnLanguageType)
@@ -0,0 +1,52 @@
1
+ /*
2
+ file aggressive_tokenizer_hi.js , located at lib\natural\tokenizers\aggressive_tokenizer_hi.js is licensed as follows:
3
+ - (The MIT License)
4
+ - Copyright (c) 2023 Mukesh Singh Bisht
5
+
6
+ Permission is hereby granted, free of charge, to any person or entity obtaining a copy
7
+ of file aggressive_tokenizer_hi.js and its content(the "Software"), to deal in the
8
+ Software without restriction, including without limitation the rights to use, copy,
9
+ modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
10
+ and to permit persons to whom the Software is furnished to do so, subject to the following
11
+ conditions:
12
+
13
+ 1. The above copyright notice and this permission notice shall be included in all copies
14
+ or substantial portions of the Software.
15
+
16
+ 2. Proper credit must be given to the original author Mukesh Singh Bisht, along with the
17
+ date of authorship specified as July 23, 2023, in any usage, distribution, or
18
+ modification of the Software.
19
+
20
+ THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
21
+ INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
22
+ PURPOSE, AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
23
+ FOR ANY CLAIM, DAMAGES, OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT, OR
24
+ OTHERWISE, ARISING FROM, OUT OF, OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25
+ DEALINGS IN THE SOFTWARE.
26
+ */
27
+
28
+ 'use strict'
29
+
30
+ const Tokenizer = require('./tokenizer')
31
+ const util = require('util')
32
+
33
+ const AggressiveTokenizer = function () {
34
+ Tokenizer.call(this)
35
+ }
36
+
37
+ util.inherits(AggressiveTokenizer, Tokenizer)
38
+
39
+ /*
40
+ To know more on hindi
41
+ Important links:
42
+ 1.https://viahindi.in/hindi-vyakaran/%E0%A4%B8%E0%A4%AE%E0%A4%BE%E0%A4%B8-samas-in-hindi
43
+ 2.https://hindigrammar.in/
44
+ 3.https://www.unicode.org/charts/PDF/U0900.pdf
45
+ */
46
+
47
+ AggressiveTokenizer.prototype.tokenize = function (text) {
48
+ const response = this.trim(text.replace(/[\u0964\u0965...?,]/g, '').split(/\s+|(?![\u0900-\u097F\u0020-\u007F])./u)).filter(Boolean)
49
+ return response
50
+ }
51
+
52
+ module.exports = AggressiveTokenizer
@@ -83,6 +83,10 @@ export class AggressiveTokenizerId extends Tokenizer {
83
83
  tokenize (text: string): string[]
84
84
  }
85
85
 
86
+ export class AggressiveTokenizerHi extends Tokenizer {
87
+ tokenize (text: string): string[]
88
+ }
89
+
86
90
  export class AggressiveTokenizer extends Tokenizer {
87
91
  tokenize (text: string): string[]
88
92
  }
@@ -35,6 +35,7 @@ exports.AggressiveTokenizerNo = require('./aggressive_tokenizer_no')
35
35
  exports.AggressiveTokenizerSv = require('./aggressive_tokenizer_sv')
36
36
  exports.AggressiveTokenizerVi = require('./aggressive_tokenizer_vi')
37
37
  exports.AggressiveTokenizerId = require('./aggressive_tokenizer_id')
38
+ exports.AggressiveTokenizerHi = require('./aggressive_tokenizer_hi')
38
39
  exports.AggressiveTokenizer = require('./aggressive_tokenizer')
39
40
  exports.CaseTokenizer = require('./tokenizer_case')
40
41
  exports.RegexpTokenizer = require('./regexp_tokenizer').RegexpTokenizer
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": "6.5.1",
4
+ "version": "6.7.0",
5
5
  "homepage": "https://github.com/NaturalNode/natural",
6
6
  "repository": {
7
7
  "type": "git",