keyphrase 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.rspec +3 -0
- data/LICENSE.txt +22 -0
- data/README.md +74 -0
- data/Rakefile +8 -0
- data/lib/keyphrase/stoplist/eng.rb +1896 -0
- data/lib/keyphrase/stoplist.rb +21 -0
- data/lib/keyphrase/version.rb +5 -0
- data/lib/keyphrase.rb +153 -0
- data/sig/keyphrase.rbs +4 -0
- metadata +55 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: b93bac15e3ec17af2a33f9f4c92ffc127e6963acf520d7ef253599652662c8ac
|
4
|
+
data.tar.gz: 55e9a1e431414ff360707bc5ba5319978bce1293a4eb9c83941baa3b9051f0e9
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: db4181abd7629d99df0be7855dc20d4bf9cc64d1299d56973f474ab48abe940ec121063572843fc566631b32a0a69bda205152b817e8bc92f0ff8b6ce3101d91
|
7
|
+
data.tar.gz: f2be99d0eca63fa493d2347c3121d2e817829ed3bc19dc62f15aaccc376dc1dca25c378d4001b259fe63a117cf4a74c4c701fc084a361f1114a0281d95643ce8
|
data/.rspec
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2023 Ben D'Angelo
|
4
|
+
Copyright (c) 2013, Darius Morawiec
|
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.
|
data/README.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Keyphrase
|
2
|
+
|
3
|
+
Extracts keywords from texts using a stoplist and some magic. This is forked
|
4
|
+
from the original gem [rake_text](https://github.com/voidplus/rake-text-ruby)
|
5
|
+
and has some added improvements.
|
6
|
+
|
7
|
+
* Multi-language support.
|
8
|
+
* Better split word support, handles - and ' characters better.
|
9
|
+
* Stop word is not removed if deemed important.
|
10
|
+
|
11
|
+
## Installation
|
12
|
+
|
13
|
+
Install [Keyphrase](https://rubygems.org/gems/keyphrase) via RubyGem:
|
14
|
+
|
15
|
+
```
|
16
|
+
gem install keyphrase
|
17
|
+
```
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
Import the library and create an instance:
|
22
|
+
|
23
|
+
```
|
24
|
+
require 'keyphrase'
|
25
|
+
keyphrase = Keyphrase.new
|
26
|
+
```
|
27
|
+
|
28
|
+
Use the Smart Stoplist:
|
29
|
+
|
30
|
+
```
|
31
|
+
keyphrase.analyse "your text", stoplist: Keyphrase.stopwords[:en]
|
32
|
+
# → {"compatibility"=>1.0, "systems"=>1.0, "linear constraints"=>4.5, "set"=>2.0, "natural numbers"=>4.0, "criteria"=>1.0, "system"=>1.0, "linear diophantine equations"=>8.5, "strict inequations"=>4.0, "nonstrict inequations"=>4.0, "considered"=>1.5, "upper bounds"=>4.0, "components"=>1.0, "minimal set"=>4.666666666666666, "solutions"=>1.0, "algorithms"=>1.0, "construction"=>1.0, "minimal generating sets"=>8.666666666666666, "types"=>1.6666666666666667, "constructing"=>1.0, "minimal supporting set"=>7.666666666666666, "solving"=>1.0, "considered types"=>3.166666666666667, "mixed types"=>3.666666666666667}
|
33
|
+
```
|
34
|
+
|
35
|
+
Use a custom stopword list:
|
36
|
+
|
37
|
+
```
|
38
|
+
keyphrase.analyse "your text", ["custom","stopword","list"]
|
39
|
+
```
|
40
|
+
|
41
|
+
Shorthand usage:
|
42
|
+
|
43
|
+
```
|
44
|
+
Keyphrase.analyse "your text"
|
45
|
+
```
|
46
|
+
|
47
|
+
Show sorted results:
|
48
|
+
|
49
|
+
```
|
50
|
+
keyphrase.analyse "your text", verbose: true
|
51
|
+
# 8.67 - minimal generating sets
|
52
|
+
# 8.50 - linear diophantine equations
|
53
|
+
# 7.67 - minimal supporting set
|
54
|
+
# 4.67 - minimal set
|
55
|
+
# 4.50 - linear constraints
|
56
|
+
# 4.00 - upper bounds
|
57
|
+
# 4.00 - strict inequations
|
58
|
+
# [...]
|
59
|
+
# → {"compatibility"=>1.0, "systems"=>1.0, "linear constraints"=>4.5, "set"=>2.0, "natural numbers"=>4.0, "criteria"=>1.0, "system"=>1.0, "linear diophantine equations"=>8.5, "strict inequations"=>4.0, "nonstrict inequations"=>4.0, "considered"=>1.5, "upper bounds"=>4.0, "components"=>1.0, "minimal set"=>4.666666666666666, "solutions"=>1.0, "algorithms"=>1.0, "construction"=>1.0, "minimal generating sets"=>8.666666666666666, "types"=>1.6666666666666667, "constructing"=>1.0, "minimal supporting set"=>7.666666666666666, "solving"=>1.0, "considered types"=>3.166666666666667, "mixed types"=>3.666666666666667}
|
60
|
+
```
|
61
|
+
|
62
|
+
## Development
|
63
|
+
|
64
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
65
|
+
|
66
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
67
|
+
|
68
|
+
## Contributing
|
69
|
+
|
70
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/bendangelo/keyphrase.
|
71
|
+
|
72
|
+
## License
|
73
|
+
|
74
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|