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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d25c6d473e1ee0a8ba79af357571181539b6e18e6b8d11e85fcca037069be3bf
4
- data.tar.gz: dbc3621f7fbc0ab5569b9f98a527c20cbc4192c6db211504a904364452518caf
3
+ metadata.gz: 496288d7d3ff1215ded1fd210192d5887a6a071eea5f322295a669a5d648d77b
4
+ data.tar.gz: 47996496009cbcdaab38a9dc9bf6efbbe7fc0145f315b0a48bfab0f543742f94
5
5
  SHA512:
6
- metadata.gz: 7a6568d91518fa0c4aedd748fe2b7c2db745a2997efb03c00993ebc24f6682422d209aa266912bcaca32c2033b6babbf9b14db2bf39973b4a33a69fa9ed07eca
7
- data.tar.gz: 2c87eeccbb22e90c87611024429918e4a3fbdcf8212d6b6538e063d6e0116a457a6c855bafad4ac4621bfb7ae91ff18d2cea0cbcf56dfdff79c2ec88666cbf18
6
+ metadata.gz: 36e7415ad06207066844a30001c8541865f066d1e83a4a2ddc5182c54b704cd3d442cbccce219bd2114717a83656d07558c42725eca75597fea239b6e13244ab
7
+ data.tar.gz: 988eff4d242d0425910b96fac4188df079c8c53c3abea2825cc97d5af5118841680705fa33461a5b4cfa7b8d6b32a486465e44b75f20fad324e4623c6c8083d8
@@ -24,7 +24,6 @@ module DocID
24
24
  docs = self.collect do |docid|
25
25
  text = self.corpus[docid]
26
26
  namespace, id, type = docid.split(":")
27
- #Document.setup(text, namespace, id, type, :corpus => corpus)
28
27
  text
29
28
  end
30
29
  Document.setup(docs, :corpus => corpus)
@@ -10,16 +10,16 @@ module Document::Corpus
10
10
 
11
11
  def add_document(document)
12
12
  docid = document.docid
13
- return document if self.include?(docid)
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.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-06-17 00:00:00.000000000 Z
11
+ date: 2020-07-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rbbt-util