ark_tweet_nlp 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e36b418a86b2d2e4fe41564a51bdd55093ad1d17
4
- data.tar.gz: 97e2931247bc851734a364b72917e2267ea75648
3
+ metadata.gz: 3e871d9a343c2765aa5ffe330399d65186a8f53d
4
+ data.tar.gz: e38987b047782875d9da857935b0570fda9ed8fd
5
5
  SHA512:
6
- metadata.gz: c411a204f88b578e1f3f897785dcf0b649fbb87d3a79c00081eb859ac9de2f4dfa5c116a28b87c1ec43e67421acafc3dc26243339023dd0356b851200a2d4ed9
7
- data.tar.gz: f7d8b63bb5aa4e49edf2d9eb0e9bca19bec8cb68fa73f4ec96a04776ceeb8e113ff8de5ebbba3c3ecb6037c9bf65c1ffa771429fe1193c8caaee1c3220d16762
6
+ metadata.gz: 96f63bbdd0534f4b63a5a93c96c5d14702ea572c2286febc45dccda9ee6844c0070e878286557bb66dc2a6c89bc34cc146cf75095d48a99324f82d1efff09c54
7
+ data.tar.gz: 5f709d7f6ef82b0942cad0380afc827d4c080ea9acc9f5ec6294797691a893f1582e820a2c66636ea10d5fc5edb2b4149dcc19c488e838e57e1d34e8b6aa82b7
@@ -45,7 +45,10 @@ module ArkTweetNlp
45
45
  end
46
46
 
47
47
  def Parser.get_words_tagged_as tagged_result, *tags
48
- Parser.merge_array( tagged_result.map{ |e| Parser.safe_invert( e ).select{ |key| tags.include? key } })
48
+ tagged_result.inject({}) do |acum,m|
49
+ m.each{ |key, value| acum[value] == nil ? acum[value] = Array.new( [key] ) : acum[value] << key }
50
+ acum
51
+ end.select{ |m| tags.include?( m ) }
49
52
  end
50
53
 
51
54
  private
@@ -1,3 +1,3 @@
1
1
  module ArkTweetNlp
2
- VERSION = "0.3.0"
2
+ VERSION = "0.3.1"
3
3
  end
data/spec/parser_spec.rb CHANGED
@@ -27,15 +27,15 @@ describe ArkTweetNlp::Parser do
27
27
  describe '#get_words_tagged_as' do
28
28
  it "returns only the words that where tagged with the specified tags" do
29
29
  tagged_result =[{'faceboooooooook' => :^,'is' => :V,'awesome' => :A}]
30
- expect(ArkTweetNlp::Parser.get_words_tagged_as(tagged_result, :A)).to eq(:A => (Set.new(['awesome']) ))
30
+ expect(ArkTweetNlp::Parser.get_words_tagged_as(tagged_result, :A)).to eq({:A=>["awesome"]} )
31
31
  end
32
32
  it "supports multiple tags" do
33
33
  tagged_result = [{'faceboooooooook' => :^,'is' => :V,'awesome' => :A}]
34
- expect(ArkTweetNlp::Parser.get_words_tagged_as(tagged_result, :A,:V,:^)).to eq( {:^ => Set.new(["faceboooooooook"]), :V => Set.new(["is"]), :A => Set.new(["awesome"]) })
34
+ expect(ArkTweetNlp::Parser.get_words_tagged_as(tagged_result, :A,:V,:^)).to eq({:^ => ["faceboooooooook"], :V => ["is"], :A => ["awesome"]})
35
35
  end
36
36
  it "supports muliple hashes" do
37
37
  tagged_result = [{'faceboooooooook' => :^,'is' => :V,'awesome' => :A},{'faceboooooooook' => :^,'is' => :V,'awesome' => :A, 'blossom' => :A}]
38
- expect(ArkTweetNlp::Parser.get_words_tagged_as(tagged_result, :A,:V,:^)).to eq( {:^ => Set.new(["faceboooooooook"]), :V => Set.new(["is"]), :A => Set.new(["awesome","blossom"]) })
38
+ expect(ArkTweetNlp::Parser.get_words_tagged_as(tagged_result, :A,:V,:^)).to eq({:^ => ["faceboooooooook", "faceboooooooook"], :V => ["is", "is"], :A => ["awesome", "awesome", "blossom"]})
39
39
  end
40
40
  end
41
41
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ark_tweet_nlp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bernardo