MCPcopy Create free account
hub / github.com/NVIDIA/cutlass / Stemmer

Function Stemmer

python/docs/_static/language_data.js:21–198  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

19 * Porter Stemmer
20 */
21var Stemmer = function() {
22
23 var step2list = {
24 ational: 'ate',
25 tional: 'tion',
26 enci: 'ence',
27 anci: 'ance',
28 izer: 'ize',
29 bli: 'ble',
30 alli: 'al',
31 entli: 'ent',
32 eli: 'e',
33 ousli: 'ous',
34 ization: 'ize',
35 ation: 'ate',
36 ator: 'ate',
37 alism: 'al',
38 iveness: 'ive',
39 fulness: 'ful',
40 ousness: 'ous',
41 aliti: 'al',
42 iviti: 'ive',
43 biliti: 'ble',
44 logi: 'log'
45 };
46
47 var step3list = {
48 icate: 'ic',
49 ative: '',
50 alize: 'al',
51 iciti: 'ic',
52 ical: 'ic',
53 ful: '',
54 ness: ''
55 };
56
57 var c = "[^aeiou]"; // consonant
58 var v = "[aeiouy]"; // vowel
59 var C = c + "[^aeiouy]*"; // consonant sequence
60 var V = v + "[aeiou]*"; // vowel sequence
61
62 var mgr0 = "^(" + C + ")?" + V + C; // [C]VC... is m>0
63 var meq1 = "^(" + C + ")?" + V + C + "(" + V + ")?$"; // [C]VC[V] is m=1
64 var mgr1 = "^(" + C + ")?" + V + C + V + C; // [C]VCVC... is m>1
65 var s_v = "^(" + C + ")?" + v; // vowel in stem
66
67 this.stemWord = function (w) {
68 var stem;
69 var suffix;
70 var firstch;
71 var origword = w;
72
73 if (w.length < 3)
74 return w;
75
76 var re;
77 var re2;
78 var re3;

Callers

nothing calls this directly

Calls 1

execMethod · 0.80

Tested by

no test coverage detected