rbbt-text 1.3.3 → 1.3.4
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/lib/rbbt/document.rb +0 -1
- data/lib/rbbt/document/corpus.rb +5 -3
- data/lib/rbbt/segment/named_entity.rb +3 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 496288d7d3ff1215ded1fd210192d5887a6a071eea5f322295a669a5d648d77b
|
4
|
+
data.tar.gz: 47996496009cbcdaab38a9dc9bf6efbbe7fc0145f315b0a48bfab0f543742f94
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 36e7415ad06207066844a30001c8541865f066d1e83a4a2ddc5182c54b704cd3d442cbccce219bd2114717a83656d07558c42725eca75597fea239b6e13244ab
|
7
|
+
data.tar.gz: 988eff4d242d0425910b96fac4188df079c8c53c3abea2825cc97d5af5118841680705fa33461a5b4cfa7b8d6b32a486465e44b75f20fad324e4623c6c8083d8
|
data/lib/rbbt/document.rb
CHANGED
data/lib/rbbt/document/corpus.rb
CHANGED
@@ -10,16 +10,16 @@ module Document::Corpus
|
|
10
10
|
|
11
11
|
def add_document(document)
|
12
12
|
docid = document.docid
|
13
|
-
return
|
13
|
+
return self[docid] if self.include?(docid)
|
14
14
|
self.write_and_close do
|
15
15
|
self[docid] = document
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
19
19
|
def docids(prefix)
|
20
|
-
prefix += ":" unless prefix[-1] == ":"
|
20
|
+
prefix += ":" unless prefix == :all || prefix[-1] == ":"
|
21
21
|
docids = self.read_and_close do
|
22
|
-
self.prefix(prefix)
|
22
|
+
prefix == :all ? self.keys : self.prefix(prefix)
|
23
23
|
end
|
24
24
|
DocID.setup(docids, :corpus => self)
|
25
25
|
end
|
@@ -35,6 +35,7 @@ module Document::Corpus
|
|
35
35
|
super(*args)
|
36
36
|
end
|
37
37
|
|
38
|
+
res.force_encoding(Encoding.default_external) if res
|
38
39
|
return res if args.length > 1
|
39
40
|
|
40
41
|
namespace, id, type = docid.split(":")
|
@@ -45,6 +46,7 @@ module Document::Corpus
|
|
45
46
|
end
|
46
47
|
end
|
47
48
|
|
49
|
+
res.force_encoding(Encoding.default_external) if res
|
48
50
|
Document.setup(res, namespace, id, type, self) unless res.nil?
|
49
51
|
|
50
52
|
res
|
@@ -19,11 +19,14 @@ Score: #{score.inspect}
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def html
|
22
|
+
title = code.nil? ? entity_type : [entity_type, code].compact * ":"
|
23
|
+
|
22
24
|
text = <<-EOF
|
23
25
|
<span class='Entity'\
|
24
26
|
#{entity_type.nil? ? "" : " attr-entity-type='#{Array === entity_type ? entity_type * " " : entity_type}'"}\
|
25
27
|
#{code.nil? ? "" : " attr-entity-code='#{Array === code ? code * " " : code}'"}\
|
26
28
|
#{score.nil? ? "" : " attr-entity-score='#{Array === score ? score * " " : score}'"}\
|
29
|
+
#{title.nil? ? "" : " title='#{Array === title ? title * " " : title}'"}\
|
27
30
|
>#{ self }</span>
|
28
31
|
EOF
|
29
32
|
text.chomp
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rbbt-text
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Miguel Vazquez
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-07-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rbbt-util
|