NaiveText 0.5.0 → 0.5.1
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -1
- data/lib/NaiveText/Categories.rb +3 -0
- data/lib/NaiveText/CategoriesFactory.rb +7 -2
- data/lib/NaiveText/Category.rb +1 -1
- data/lib/NaiveText/ProbabilityCollection.rb +1 -1
- data/lib/NaiveText/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ec519a11d1de21e62b71bb470ef0097ed62910f8
|
4
|
+
data.tar.gz: bc96077d8ed6fa7890692466a2954425a8719540
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 15446a47f72ed08af4c32924f5b7b246878bdc184f21a9616259a346c010baba9f25ca426a22f60bb29ff5d9e94b9cd311c41221fdb728542d794fa7777f5c01
|
7
|
+
data.tar.gz: bfb9e832ddd6a8f3f7aebc8cc47c949f7aac93d1a718d6db461c827e247575c937ddf4ae23be3b89d6d2c0617b93d8a5f5ed1a830fc59b1f440c0bbd770e1e3b
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,10 @@
|
|
2
2
|
All notable changes to this project will be documented in this file.
|
3
3
|
This project adheres to [Semantic Versioning](http://semver.org/).
|
4
4
|
|
5
|
+
## [0.5.1] - 2015-11-21
|
6
|
+
### Added
|
7
|
+
- Added optional default category. This category will be returned from NaiveText.build if the algorithm can't find a match with the existing text examples. Default value is NullCategory.
|
8
|
+
|
5
9
|
## [0.5.0] - 2015-11-06
|
6
10
|
### Added
|
7
11
|
- Added optional weighting to categories
|
@@ -28,4 +32,5 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
|
28
32
|
|
29
33
|
|
30
34
|
[Unreleased]: https://github.com/RicciFlowing/NaiveText/compare/v0.4.0...HEAD
|
31
|
-
[0.
|
35
|
+
[0.5.0]: https://github.com/RicciFlowing/NaiveText/compare/v0.1.0...v0.5.0
|
36
|
+
[0.4.0]: https://github.com/RicciFlowing/NaiveText/compare/v0.1.0...v0.4.0
|
data/lib/NaiveText/Categories.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
class CategoriesFactory
|
2
2
|
def self.build(config)
|
3
3
|
categories = []
|
4
|
+
default = nil
|
4
5
|
if config.is_a?(Array)
|
5
6
|
puts "The format [{name: name_of_category, path: path_to_trainings_data}] is deprecated and will be removed in future versions. Use the following arguments instead: categories: [name: 'the name', examples:'An example']"
|
6
7
|
config.each do |category_config|
|
@@ -20,13 +21,17 @@ class CategoriesFactory
|
|
20
21
|
config[:categories].each do |category_config|
|
21
22
|
begin
|
22
23
|
group = ExamplesGroup.new(examples: category_config[:examples])
|
23
|
-
|
24
|
+
category = Category.new(name: category_config[:name], examples: group, weight: category_config[:weight])
|
25
|
+
categories << category
|
26
|
+
if category_config[:name] == config[:default]
|
27
|
+
default = category
|
28
|
+
end
|
24
29
|
rescue
|
25
30
|
puts "You haven't provided trainingsdata for the category" + category_config[:name]
|
26
31
|
puts "This category was not created."
|
27
32
|
end
|
28
33
|
end
|
29
|
-
Categories.new(categories: categories)
|
34
|
+
Categories.new(categories: categories, default: default )
|
30
35
|
end
|
31
36
|
end
|
32
37
|
end
|
data/lib/NaiveText/Category.rb
CHANGED
data/lib/NaiveText/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: NaiveText
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- RicciFlowing
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-11-
|
11
|
+
date: 2015-11-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|