raske-nlp 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: ecbcbf018652bd37d47dc9fa14976542a922a28a9e7a0fa6b5fd5433320591cf
4
+ data.tar.gz: cde1f719a9f497ab2973a0c6e66a23dc06142fe24c61d5c4bf4277b0ed918fba
5
+ SHA512:
6
+ metadata.gz: b633edb8e0bf49796a073f888526da8b3608a702180275858db399ac917e40b0e2fb96ed4d682814cf6e2a871121ea2371b1c94f5d4332b24a95659b69ec874b
7
+ data.tar.gz: 499dbc7271456165a6a272382adaf96da404d6226536817464d0848c8deaaea27196ce6e9432f9087e20bfc58571489812b1fb63cf4e0f495cd56c16be86cdcf
data/.gitignore ADDED
@@ -0,0 +1,23 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
12
+ .ruby-version
13
+ .ruby-gemset
14
+ *.gem
15
+
16
+
17
+ result = RaskeNLP.run(text, {
18
+ min_phrase_length: 1,
19
+ max_phrase_length: 3,
20
+ min_frequency: 1,
21
+ min_score: 1,
22
+ stop_list: RaskeNLP::StopList::ALI
23
+ })
data/.travis.yml ADDED
@@ -0,0 +1,5 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.6.6
5
+ before_install: gem install bundler -v 1.16.0
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source "https://rubygems.org"
2
+
3
+ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
+
5
+ # Specify your gem's dependencies in raske-nlp.gemspec
6
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,20 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ raske-nlp (0.1.1)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ rake (13.0.3)
10
+
11
+ PLATFORMS
12
+ ruby
13
+
14
+ DEPENDENCIES
15
+ bundler (~> 1.16)
16
+ rake (~> 13.0)
17
+ raske-nlp!
18
+
19
+ BUNDLED WITH
20
+ 1.17.3
data/MIT-LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2017 Sam Pohlenz
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.
data/README.md ADDED
@@ -0,0 +1,31 @@
1
+ # raske-nlp
2
+
3
+ > Ruby implementation of the Rapid Automatic Spanish Keyword Extraction (RAKE) algorithm
4
+
5
+ ## Usage
6
+
7
+ ```ruby
8
+ text = "Uno de enero, dos de febrero, tres de marzo, cuatro de abril, cinco de mayo,
9
+ seis de junio siete de julio, ¡SAN FERMÍN! Uno de enero, dos de febrero,
10
+ tres de marzo, cuatro de abril, cinco de mayo, seis de junio siete de julio, ¡SAN FERMÍN!
11
+ A Pamplona hemos de ir, con una media, con una media, a Pamplona hemos de ir
12
+ con una media y un calcetín."
13
+
14
+ result = RaskeNLP.run(text, {
15
+ min_phrase_length: 1,
16
+ max_phrase_length: 3,
17
+ min_frequency: 1,
18
+ min_score: 1,
19
+ stop_list: RaskeNLP::StopList::ISO
20
+ })
21
+
22
+ result.keywords
23
+ ```
24
+
25
+ ```ruby
26
+ => {"san fermín"=>15.333333333333334, "calcetín"=>5.333333333333334, "media"=>1.0, "pamplona"=>1.0, "julio"=>1.0, "junio"=>1.0, "mayo"=>1.0, "abril"=>1.0, "marzo"=>1.0, "febrero"=>1.0, "enero"=>1.0}
27
+ ```
28
+
29
+ ## License
30
+
31
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "raske-nlp"
5
+
6
+ TEXT = <<-EOF.strip
7
+ Compatibility of systems of linear constraints over the set of natural numbers
8
+ Criteria of compatibility of a system of linear Diophantine equations, strict inequations, and nonstrict inequations are considered. Upper bounds for components of a minimal set of solutions and algorithms of construction of minimal generating sets of solutions for all types of systems are given. These criteria and the corresponding algorithms for constructing a minimal supporting set of solutions can be used in solving all the considered types of systems and systems of mixed types.
9
+ EOF
10
+
11
+ puts "TEXT: #{TEXT.inspect}"
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
@@ -0,0 +1,309 @@
1
+ # From https://raw.githubusercontent.com/Alir3z4/stop-words/master/spanish.txt
2
+ a
3
+ al
4
+ algo
5
+ algunas
6
+ algunos
7
+ ante
8
+ antes
9
+ como
10
+ con
11
+ contra
12
+ cual
13
+ cuando
14
+ de
15
+ del
16
+ desde
17
+ donde
18
+ durante
19
+ e
20
+ el
21
+ ella
22
+ ellas
23
+ ellos
24
+ en
25
+ entre
26
+ era
27
+ erais
28
+ eran
29
+ eras
30
+ eres
31
+ es
32
+ esa
33
+ esas
34
+ ese
35
+ eso
36
+ esos
37
+ esta
38
+ estaba
39
+ estabais
40
+ estaban
41
+ estabas
42
+ estad
43
+ estada
44
+ estadas
45
+ estado
46
+ estados
47
+ estamos
48
+ estando
49
+ estar
50
+ estaremos
51
+ estará
52
+ estarán
53
+ estarás
54
+ estaré
55
+ estaréis
56
+ estaría
57
+ estaríais
58
+ estaríamos
59
+ estarían
60
+ estarías
61
+ estas
62
+ este
63
+ estemos
64
+ esto
65
+ estos
66
+ estoy
67
+ estuve
68
+ estuviera
69
+ estuvierais
70
+ estuvieran
71
+ estuvieras
72
+ estuvieron
73
+ estuviese
74
+ estuvieseis
75
+ estuviesen
76
+ estuvieses
77
+ estuvimos
78
+ estuviste
79
+ estuvisteis
80
+ estuviéramos
81
+ estuviésemos
82
+ estuvo
83
+ está
84
+ estábamos
85
+ estáis
86
+ están
87
+ estás
88
+ esté
89
+ estéis
90
+ estén
91
+ estés
92
+ fue
93
+ fuera
94
+ fuerais
95
+ fueran
96
+ fueras
97
+ fueron
98
+ fuese
99
+ fueseis
100
+ fuesen
101
+ fueses
102
+ fui
103
+ fuimos
104
+ fuiste
105
+ fuisteis
106
+ fuéramos
107
+ fuésemos
108
+ ha
109
+ habida
110
+ habidas
111
+ habido
112
+ habidos
113
+ habiendo
114
+ habremos
115
+ habrá
116
+ habrán
117
+ habrás
118
+ habré
119
+ habréis
120
+ habría
121
+ habríais
122
+ habríamos
123
+ habrían
124
+ habrías
125
+ habéis
126
+ había
127
+ habíais
128
+ habíamos
129
+ habían
130
+ habías
131
+ han
132
+ has
133
+ hasta
134
+ hay
135
+ haya
136
+ hayamos
137
+ hayan
138
+ hayas
139
+ hayáis
140
+ he
141
+ hemos
142
+ hube
143
+ hubiera
144
+ hubierais
145
+ hubieran
146
+ hubieras
147
+ hubieron
148
+ hubiese
149
+ hubieseis
150
+ hubiesen
151
+ hubieses
152
+ hubimos
153
+ hubiste
154
+ hubisteis
155
+ hubiéramos
156
+ hubiésemos
157
+ hubo
158
+ la
159
+ las
160
+ le
161
+ les
162
+ lo
163
+ los
164
+ me
165
+ mi
166
+ mis
167
+ mucho
168
+ muchos
169
+ muy
170
+ más
171
+
172
+ mía
173
+ mías
174
+ mío
175
+ míos
176
+ nada
177
+ ni
178
+ no
179
+ nos
180
+ nosotras
181
+ nosotros
182
+ nuestra
183
+ nuestras
184
+ nuestro
185
+ nuestros
186
+ o
187
+ os
188
+ otra
189
+ otras
190
+ otro
191
+ otros
192
+ para
193
+ pero
194
+ poco
195
+ por
196
+ porque
197
+ que
198
+ quien
199
+ quienes
200
+ qué
201
+ se
202
+ sea
203
+ seamos
204
+ sean
205
+ seas
206
+ seremos
207
+ será
208
+ serán
209
+ serás
210
+ seré
211
+ seréis
212
+ sería
213
+ seríais
214
+ seríamos
215
+ serían
216
+ serías
217
+ seáis
218
+ sido
219
+ siendo
220
+ sin
221
+ sobre
222
+ sois
223
+ somos
224
+ son
225
+ soy
226
+ su
227
+ sus
228
+ suya
229
+ suyas
230
+ suyo
231
+ suyos
232
+
233
+ también
234
+ tanto
235
+ te
236
+ tendremos
237
+ tendrá
238
+ tendrán
239
+ tendrás
240
+ tendré
241
+ tendréis
242
+ tendría
243
+ tendríais
244
+ tendríamos
245
+ tendrían
246
+ tendrías
247
+ tened
248
+ tenemos
249
+ tenga
250
+ tengamos
251
+ tengan
252
+ tengas
253
+ tengo
254
+ tengáis
255
+ tenida
256
+ tenidas
257
+ tenido
258
+ tenidos
259
+ teniendo
260
+ tenéis
261
+ tenía
262
+ teníais
263
+ teníamos
264
+ tenían
265
+ tenías
266
+ ti
267
+ tiene
268
+ tienen
269
+ tienes
270
+ todo
271
+ todos
272
+ tu
273
+ tus
274
+ tuve
275
+ tuviera
276
+ tuvierais
277
+ tuvieran
278
+ tuvieras
279
+ tuvieron
280
+ tuviese
281
+ tuvieseis
282
+ tuviesen
283
+ tuvieses
284
+ tuvimos
285
+ tuviste
286
+ tuvisteis
287
+ tuviéramos
288
+ tuviésemos
289
+ tuvo
290
+ tuya
291
+ tuyas
292
+ tuyo
293
+ tuyos
294
+
295
+ un
296
+ una
297
+ uno
298
+ unos
299
+ vosotras
300
+ vosotros
301
+ vuestra
302
+ vuestras
303
+ vuestro
304
+ vuestros
305
+ y
306
+ ya
307
+ yo
308
+ él
309
+ éramos
@@ -0,0 +1,733 @@
1
+ #stop word list from ISO (Salton,1971). Available at https://github.com/stopwords-iso/stopwords-es/blob/master/stopwords-es.txt
2
+ 0
3
+ 1
4
+ 2
5
+ 3
6
+ 4
7
+ 5
8
+ 6
9
+ 7
10
+ 8
11
+ 9
12
+ _
13
+ a
14
+ actualmente
15
+ acuerdo
16
+ adelante
17
+ ademas
18
+ además
19
+ adrede
20
+ afirmó
21
+ agregó
22
+ ahi
23
+ ahora
24
+ ahí
25
+ al
26
+ algo
27
+ alguna
28
+ algunas
29
+ alguno
30
+ algunos
31
+ algún
32
+ alli
33
+ allí
34
+ alrededor
35
+ ambos
36
+ ampleamos
37
+ antano
38
+ antaño
39
+ ante
40
+ anterior
41
+ antes
42
+ apenas
43
+ aproximadamente
44
+ aquel
45
+ aquella
46
+ aquellas
47
+ aquello
48
+ aquellos
49
+ aqui
50
+ aquél
51
+ aquélla
52
+ aquéllas
53
+ aquéllos
54
+ aquí
55
+ arriba
56
+ arribaabajo
57
+ aseguró
58
+ asi
59
+ así
60
+ atras
61
+ aun
62
+ aunque
63
+ ayer
64
+ añadió
65
+ aún
66
+ b
67
+ bajo
68
+ bastante
69
+ bien
70
+ breve
71
+ buen
72
+ buena
73
+ buenas
74
+ bueno
75
+ buenos
76
+ c
77
+ cada
78
+ casi
79
+ cerca
80
+ cierta
81
+ ciertas
82
+ cierto
83
+ ciertos
84
+ cinco
85
+ claro
86
+ comentó
87
+ como
88
+ con
89
+ conmigo
90
+ conocer
91
+ conseguimos
92
+ conseguir
93
+ considera
94
+ consideró
95
+ consigo
96
+ consigue
97
+ consiguen
98
+ consigues
99
+ contigo
100
+ contra
101
+ cosas
102
+ creo
103
+ cual
104
+ cuales
105
+ cualquier
106
+ cuando
107
+ cuanta
108
+ cuantas
109
+ cuanto
110
+ cuantos
111
+ cuatro
112
+ cuenta
113
+ cuál
114
+ cuáles
115
+ cuándo
116
+ cuánta
117
+ cuántas
118
+ cuánto
119
+ cuántos
120
+ cómo
121
+ d
122
+ da
123
+ dado
124
+ dan
125
+ dar
126
+ de
127
+ debajo
128
+ debe
129
+ deben
130
+ debido
131
+ decir
132
+ dejó
133
+ del
134
+ delante
135
+ demasiado
136
+ demás
137
+ dentro
138
+ deprisa
139
+ desde
140
+ despacio
141
+ despues
142
+ después
143
+ detras
144
+ detrás
145
+ dia
146
+ dias
147
+ dice
148
+ dicen
149
+ dicho
150
+ dieron
151
+ diferente
152
+ diferentes
153
+ dijeron
154
+ dijo
155
+ dio
156
+ donde
157
+ dos
158
+ durante
159
+ día
160
+ días
161
+ dónde
162
+ e
163
+ ejemplo
164
+ el
165
+ ella
166
+ ellas
167
+ ello
168
+ ellos
169
+ embargo
170
+ empleais
171
+ emplean
172
+ emplear
173
+ empleas
174
+ empleo
175
+ en
176
+ encima
177
+ encuentra
178
+ enfrente
179
+ enseguida
180
+ entonces
181
+ entre
182
+ era
183
+ erais
184
+ eramos
185
+ eran
186
+ eras
187
+ eres
188
+ es
189
+ esa
190
+ esas
191
+ ese
192
+ eso
193
+ esos
194
+ esta
195
+ estaba
196
+ estabais
197
+ estaban
198
+ estabas
199
+ estad
200
+ estada
201
+ estadas
202
+ estado
203
+ estados
204
+ estais
205
+ estamos
206
+ estan
207
+ estando
208
+ estar
209
+ estaremos
210
+ estará
211
+ estarán
212
+ estarás
213
+ estaré
214
+ estaréis
215
+ estaría
216
+ estaríais
217
+ estaríamos
218
+ estarían
219
+ estarías
220
+ estas
221
+ este
222
+ estemos
223
+ esto
224
+ estos
225
+ estoy
226
+ estuve
227
+ estuviera
228
+ estuvierais
229
+ estuvieran
230
+ estuvieras
231
+ estuvieron
232
+ estuviese
233
+ estuvieseis
234
+ estuviesen
235
+ estuvieses
236
+ estuvimos
237
+ estuviste
238
+ estuvisteis
239
+ estuviéramos
240
+ estuviésemos
241
+ estuvo
242
+ está
243
+ estábamos
244
+ estáis
245
+ están
246
+ estás
247
+ esté
248
+ estéis
249
+ estén
250
+ estés
251
+ ex
252
+ excepto
253
+ existe
254
+ existen
255
+ explicó
256
+ expresó
257
+ f
258
+ fin
259
+ final
260
+ fue
261
+ fuera
262
+ fuerais
263
+ fueran
264
+ fueras
265
+ fueron
266
+ fuese
267
+ fueseis
268
+ fuesen
269
+ fueses
270
+ fui
271
+ fuimos
272
+ fuiste
273
+ fuisteis
274
+ fuéramos
275
+ fuésemos
276
+ g
277
+ general
278
+ gran
279
+ grandes
280
+ gueno
281
+ h
282
+ ha
283
+ haber
284
+ habia
285
+ habida
286
+ habidas
287
+ habido
288
+ habidos
289
+ habiendo
290
+ habla
291
+ hablan
292
+ habremos
293
+ habrá
294
+ habrán
295
+ habrás
296
+ habré
297
+ habréis
298
+ habría
299
+ habríais
300
+ habríamos
301
+ habrían
302
+ habrías
303
+ habéis
304
+ había
305
+ habíais
306
+ habíamos
307
+ habían
308
+ habías
309
+ hace
310
+ haceis
311
+ hacemos
312
+ hacen
313
+ hacer
314
+ hacerlo
315
+ haces
316
+ hacia
317
+ haciendo
318
+ hago
319
+ han
320
+ has
321
+ hasta
322
+ hay
323
+ haya
324
+ hayamos
325
+ hayan
326
+ hayas
327
+ hayáis
328
+ he
329
+ hecho
330
+ hemos
331
+ hicieron
332
+ hizo
333
+ horas
334
+ hoy
335
+ hube
336
+ hubiera
337
+ hubierais
338
+ hubieran
339
+ hubieras
340
+ hubieron
341
+ hubiese
342
+ hubieseis
343
+ hubiesen
344
+ hubieses
345
+ hubimos
346
+ hubiste
347
+ hubisteis
348
+ hubiéramos
349
+ hubiésemos
350
+ hubo
351
+ i
352
+ igual
353
+ incluso
354
+ indicó
355
+ informo
356
+ informó
357
+ intenta
358
+ intentais
359
+ intentamos
360
+ intentan
361
+ intentar
362
+ intentas
363
+ intento
364
+ ir
365
+ j
366
+ junto
367
+ k
368
+ l
369
+ la
370
+ lado
371
+ largo
372
+ las
373
+ le
374
+ lejos
375
+ les
376
+ llegó
377
+ lleva
378
+ llevar
379
+ lo
380
+ los
381
+ luego
382
+ lugar
383
+ m
384
+ mal
385
+ manera
386
+ manifestó
387
+ mas
388
+ mayor
389
+ me
390
+ mediante
391
+ medio
392
+ mejor
393
+ mencionó
394
+ menos
395
+ menudo
396
+ mi
397
+ mia
398
+ mias
399
+ mientras
400
+ mio
401
+ mios
402
+ mis
403
+ misma
404
+ mismas
405
+ mismo
406
+ mismos
407
+ modo
408
+ momento
409
+ mucha
410
+ muchas
411
+ mucho
412
+ muchos
413
+ muy
414
+ más
415
+
416
+ mía
417
+ mías
418
+ mío
419
+ míos
420
+ n
421
+ nada
422
+ nadie
423
+ ni
424
+ ninguna
425
+ ningunas
426
+ ninguno
427
+ ningunos
428
+ ningún
429
+ no
430
+ nos
431
+ nosotras
432
+ nosotros
433
+ nuestra
434
+ nuestras
435
+ nuestro
436
+ nuestros
437
+ nueva
438
+ nuevas
439
+ nuevo
440
+ nuevos
441
+ nunca
442
+ o
443
+ ocho
444
+ os
445
+ otra
446
+ otras
447
+ otro
448
+ otros
449
+ p
450
+ pais
451
+ para
452
+ parece
453
+ parte
454
+ partir
455
+ pasada
456
+ pasado
457
+ paìs
458
+ peor
459
+ pero
460
+ pesar
461
+ poca
462
+ pocas
463
+ poco
464
+ pocos
465
+ podeis
466
+ podemos
467
+ poder
468
+ podria
469
+ podriais
470
+ podriamos
471
+ podrian
472
+ podrias
473
+ podrá
474
+ podrán
475
+ podría
476
+ podrían
477
+ poner
478
+ por
479
+ por qué
480
+ porque
481
+ posible
482
+ primer
483
+ primera
484
+ primero
485
+ primeros
486
+ principalmente
487
+ pronto
488
+ propia
489
+ propias
490
+ propio
491
+ propios
492
+ proximo
493
+ próximo
494
+ próximos
495
+ pudo
496
+ pueda
497
+ puede
498
+ pueden
499
+ puedo
500
+ pues
501
+ q
502
+ qeu
503
+ que
504
+ quedó
505
+ queremos
506
+ quien
507
+ quienes
508
+ quiere
509
+ quiza
510
+ quizas
511
+ quizá
512
+ quizás
513
+ quién
514
+ quiénes
515
+ qué
516
+ r
517
+ raras
518
+ realizado
519
+ realizar
520
+ realizó
521
+ repente
522
+ respecto
523
+ s
524
+ sabe
525
+ sabeis
526
+ sabemos
527
+ saben
528
+ saber
529
+ sabes
530
+ sal
531
+ salvo
532
+ se
533
+ sea
534
+ seamos
535
+ sean
536
+ seas
537
+ segun
538
+ segunda
539
+ segundo
540
+ según
541
+ seis
542
+ ser
543
+ sera
544
+ seremos
545
+ será
546
+ serán
547
+ serás
548
+ seré
549
+ seréis
550
+ sería
551
+ seríais
552
+ seríamos
553
+ serían
554
+ serías
555
+ seáis
556
+ señaló
557
+ si
558
+ sido
559
+ siempre
560
+ siendo
561
+ siete
562
+ sigue
563
+ siguiente
564
+ sin
565
+ sino
566
+ sobre
567
+ sois
568
+ sola
569
+ solamente
570
+ solas
571
+ solo
572
+ solos
573
+ somos
574
+ son
575
+ soy
576
+ soyos
577
+ su
578
+ supuesto
579
+ sus
580
+ suya
581
+ suyas
582
+ suyo
583
+ suyos
584
+
585
+
586
+ sólo
587
+ t
588
+ tal
589
+ tambien
590
+ también
591
+ tampoco
592
+ tan
593
+ tanto
594
+ tarde
595
+ te
596
+ temprano
597
+ tendremos
598
+ tendrá
599
+ tendrán
600
+ tendrás
601
+ tendré
602
+ tendréis
603
+ tendría
604
+ tendríais
605
+ tendríamos
606
+ tendrían
607
+ tendrías
608
+ tened
609
+ teneis
610
+ tenemos
611
+ tener
612
+ tenga
613
+ tengamos
614
+ tengan
615
+ tengas
616
+ tengo
617
+ tengáis
618
+ tenida
619
+ tenidas
620
+ tenido
621
+ tenidos
622
+ teniendo
623
+ tenéis
624
+ tenía
625
+ teníais
626
+ teníamos
627
+ tenían
628
+ tenías
629
+ tercera
630
+ ti
631
+ tiempo
632
+ tiene
633
+ tienen
634
+ tienes
635
+ toda
636
+ todas
637
+ todavia
638
+ todavía
639
+ todo
640
+ todos
641
+ total
642
+ trabaja
643
+ trabajais
644
+ trabajamos
645
+ trabajan
646
+ trabajar
647
+ trabajas
648
+ trabajo
649
+ tras
650
+ trata
651
+ través
652
+ tres
653
+ tu
654
+ tus
655
+ tuve
656
+ tuviera
657
+ tuvierais
658
+ tuvieran
659
+ tuvieras
660
+ tuvieron
661
+ tuviese
662
+ tuvieseis
663
+ tuviesen
664
+ tuvieses
665
+ tuvimos
666
+ tuviste
667
+ tuvisteis
668
+ tuviéramos
669
+ tuviésemos
670
+ tuvo
671
+ tuya
672
+ tuyas
673
+ tuyo
674
+ tuyos
675
+
676
+ u
677
+ ultimo
678
+ un
679
+ una
680
+ unas
681
+ uno
682
+ unos
683
+ usa
684
+ usais
685
+ usamos
686
+ usan
687
+ usar
688
+ usas
689
+ uso
690
+ usted
691
+ ustedes
692
+ v
693
+ va
694
+ vais
695
+ valor
696
+ vamos
697
+ van
698
+ varias
699
+ varios
700
+ vaya
701
+ veces
702
+ ver
703
+ verdad
704
+ verdadera
705
+ verdadero
706
+ vez
707
+ vosotras
708
+ vosotros
709
+ voy
710
+ vuestra
711
+ vuestras
712
+ vuestro
713
+ vuestros
714
+ w
715
+ x
716
+ y
717
+ ya
718
+ yo
719
+ z
720
+ él
721
+ éramos
722
+ ésa
723
+ ésas
724
+ ése
725
+ ésos
726
+ ésta
727
+ éstas
728
+ éste
729
+ éstos
730
+ última
731
+ últimas
732
+ último
733
+ últimos
data/lib/raske-nlp.rb ADDED
@@ -0,0 +1,17 @@
1
+ require "raske-nlp/version"
2
+ require "raske-nlp/stop_list"
3
+ require "raske-nlp/result"
4
+
5
+ module RaskeNLP
6
+ DEFAULTS = {
7
+ min_phrase_length: 1,
8
+ max_phrase_length: 3,
9
+ min_frequency: 1,
10
+ min_score: 1,
11
+ stop_list: StopList::ISO
12
+ }
13
+
14
+ def self.run(text, options={})
15
+ RaskeNLP::Result.new(text, DEFAULTS.merge(options))
16
+ end
17
+ end
@@ -0,0 +1,79 @@
1
+ module RaskeNLP
2
+ class Result
3
+ SENTENCE_REGEX = /[\\[\\]\n.!?,;:\t\\-\\"\\(\\)\\\'\u2019\u2013]/
4
+ WORD_REGEX = /[^a-zA-Z0-9_\+\-\/]/
5
+ NUMBER_REGEX = /^-*[0-9,\.]+$/
6
+
7
+ def initialize(text, options={})
8
+ @text, @options = text, options
9
+ @stoplist_regex = options[:stop_list].to_regex
10
+ end
11
+
12
+ def sentences
13
+ @text.split(SENTENCE_REGEX).map(&:strip)
14
+ end
15
+
16
+ def phrases
17
+ @phrases ||= begin
18
+ sentences.map { |sentence|
19
+ sentence.downcase.split(@stoplist_regex).map(&:strip).select { |phrase| acceptable?(phrase) }
20
+ }.flatten
21
+ end
22
+ end
23
+
24
+ def word_scores
25
+ @word_scores ||= begin
26
+ frequencies = Hash.new(0)
27
+ degrees = Hash.new(0)
28
+
29
+ phrases.each do |phrase|
30
+ words = split_words(phrase)
31
+ words.each do |word|
32
+ frequencies[word] += 1
33
+ degrees[word] += words.length - 1
34
+ end
35
+ end
36
+
37
+ frequencies.each do |word, frequency|
38
+ degrees[word] += frequency
39
+ end
40
+
41
+ scores = {}
42
+ frequencies.each do |word, frequency|
43
+ scores[word] = degrees[word] / frequency.to_f
44
+ end
45
+ scores
46
+ end
47
+ end
48
+
49
+ def keywords
50
+ keywords = Hash.new(0)
51
+
52
+ phrases.each do |phrase|
53
+ if @options[:min_frequency] > 1
54
+ next if phrases.count(phrase) < @options[:min_frequency]
55
+ end
56
+
57
+ words = split_words(phrase)
58
+ keywords[phrase] = words.map { |word| word_scores[word] }.sum
59
+ end
60
+
61
+ keywords.select { |word, score|
62
+ score >= @options[:min_score]
63
+ }.sort_by(&:last).reverse.to_h
64
+ end
65
+
66
+ private
67
+ def split_words(str)
68
+ str.split(WORD_REGEX).reject { |word| word =~ NUMBER_REGEX }
69
+ end
70
+
71
+ def acceptable?(phrase)
72
+ !phrase.empty? &&
73
+ phrase.length >= @options[:min_phrase_length] &&
74
+ phrase.split(/\s/).length <= @options[:max_phrase_length] &&
75
+ phrase.scan(/[a-zA-Z]/).length > 0 &&
76
+ phrase.scan(/[a-zA-Z]/).length > phrase.scan(/\d/).length
77
+ end
78
+ end
79
+ end
@@ -0,0 +1,22 @@
1
+ module RaskeNLP
2
+ class StopList
3
+ def initialize(words)
4
+ @words = words
5
+ end
6
+
7
+ def to_a
8
+ @words
9
+ end
10
+
11
+ def to_regex
12
+ @regex ||= /#{@words.map { |w| "\\b#{w}(?![\\w-])" }.join("|")}/i
13
+ end
14
+
15
+ def self.read(filename)
16
+ new(File.read(filename).split("\n").reject { |line| line =~ /^#/ })
17
+ end
18
+
19
+ ISO = read(File.join(File.dirname(__FILE__), "../../data/StopWordsIso.txt"))
20
+ ALI = read(File.join(File.dirname(__FILE__), "../../data/AliStopList.txt"))
21
+ end
22
+ end
@@ -0,0 +1,3 @@
1
+ module RaskeNLP
2
+ VERSION = "0.1.5"
3
+ end
data/raske-nlp.gemspec ADDED
@@ -0,0 +1,23 @@
1
+ lib = File.expand_path("../lib", __FILE__)
2
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
+ require "raske-nlp/version"
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "raske-nlp"
7
+ spec.version = RaskeNLP::VERSION
8
+ spec.authors = ["Adrián Pradilla Pórtoles"]
9
+ spec.email = ["adrianpradilla@gmail.com"]
10
+
11
+ spec.summary = "Implementation of the Rapid Automatic Spanish Keyword Extraction (RAKE) algorithm"
12
+ spec.description = "Implementation of the Rapid Automatic Spanish Keyword Extraction (RAKE) algorithm"
13
+
14
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
15
+ f.match(%r{^(test|spec|features)/})
16
+ end
17
+ spec.bindir = "exe"
18
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.16"
22
+ spec.add_development_dependency "rake", "~> 13.0"
23
+ end
metadata ADDED
@@ -0,0 +1,86 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: raske-nlp
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.5
5
+ platform: ruby
6
+ authors:
7
+ - Adrián Pradilla Pórtoles
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2021-04-10 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.16'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.16'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '13.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '13.0'
41
+ description: Implementation of the Rapid Automatic Spanish Keyword Extraction (RAKE)
42
+ algorithm
43
+ email:
44
+ - adrianpradilla@gmail.com
45
+ executables: []
46
+ extensions: []
47
+ extra_rdoc_files: []
48
+ files:
49
+ - ".gitignore"
50
+ - ".travis.yml"
51
+ - Gemfile
52
+ - Gemfile.lock
53
+ - MIT-LICENSE
54
+ - README.md
55
+ - Rakefile
56
+ - bin/console
57
+ - data/AliStopList.txt
58
+ - data/StopWordsIso.txt
59
+ - lib/raske-nlp.rb
60
+ - lib/raske-nlp/result.rb
61
+ - lib/raske-nlp/stop_list.rb
62
+ - lib/raske-nlp/version.rb
63
+ - raske-nlp.gemspec
64
+ homepage:
65
+ licenses: []
66
+ metadata: {}
67
+ post_install_message:
68
+ rdoc_options: []
69
+ require_paths:
70
+ - lib
71
+ required_ruby_version: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ required_rubygems_version: !ruby/object:Gem::Requirement
77
+ requirements:
78
+ - - ">="
79
+ - !ruby/object:Gem::Version
80
+ version: '0'
81
+ requirements: []
82
+ rubygems_version: 3.0.8
83
+ signing_key:
84
+ specification_version: 4
85
+ summary: Implementation of the Rapid Automatic Spanish Keyword Extraction (RAKE) algorithm
86
+ test_files: []