lexical_units 0.0.6 → 0.0.7

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: 39ea38ff431ac8504a190d5568e7b006343ee6a5
4
- data.tar.gz: d95f0fcc0db377aa3e4cc265d73142dd77ca8e04
3
+ metadata.gz: e0900a1a365540816cacaf4ea41ae0ce6d70a37f
4
+ data.tar.gz: 77c84fbc21845351e53eb83fd912afc389700e34
5
5
  SHA512:
6
- metadata.gz: ae037e456ef84ebe508ea2ed85781c0ffdb48c967f858cab675ba3437a44effca7805c54db3c267fe28c391fffc9ecbe2523bf8de94de54aae5bcc598cbe885b
7
- data.tar.gz: a694d6ead66f92d9816a9822060452c88324537becf62174993a34d8d37ec79853a23f765222ce0dead985d1ca5fa0558eecbcfd03ef2b8c6c7955a487f87351
6
+ metadata.gz: 2ccaaba2910f859a987252cb9dfe38b0812462657077382fcb377e4c05d59259df9b565d56977e3699d0c6427b12da8e9d3bf1390948bd1e10fcb5cd9ca05639
7
+ data.tar.gz: 2a3bec215bdf473fe76287090aafe31f25d75ca481c0515c5c90011cd81444a9e957b32b3cfdd1a61a86046b89884a53549da05fc264534badbe652034c54ac9
data/CHANGELOG.md CHANGED
@@ -21,3 +21,7 @@
21
21
  ## v0.0.6
22
22
 
23
23
  * support words with hyphen
24
+
25
+ ## v0.0.7
26
+
27
+ * added split into words without digits
@@ -1,3 +1,3 @@
1
1
  module LexicalUnits
2
- VERSION = "0.0.6"
2
+ VERSION = "0.0.7"
3
3
  end
@@ -20,7 +20,8 @@ module LexicalUnits
20
20
  '\>', '\<',
21
21
  '\{', '\}',
22
22
  '\|', '\~',
23
- "\¿", "\¡"
23
+ "\¿", "\¡",
24
+ '\=', '\"'
24
25
  ].join
25
26
  end
26
27
  end
@@ -0,0 +1,16 @@
1
+ # encoding: utf-8
2
+ module LexicalUnits
3
+ # Split text into words without digits
4
+ #
5
+ # self.words("Lorem 0 ipsum") #=> ["Lorem", "ipsum"]
6
+ # self.words("Lorem ipsum 100") #=> ["Lorem", "ipsum"]
7
+ def self.words_without_digits(text)
8
+ LexicalUnits::words(text).delete_if { |word| numeric?(word) }
9
+ end
10
+
11
+ private
12
+ def self.numeric?(value)
13
+ return true if value =~ /^\d+$/
14
+ true if Float(value) rescue false
15
+ end
16
+ end
data/lib/lexical_units.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  require "lexical_units/words"
2
2
  require "lexical_units/sentences"
3
3
  require "lexical_units/syllables"
4
+ require "lexical_units/words_without_digits"
4
5
  require "lexical_units/string"
5
6
  require "lexical_units/version"
6
7
 
@@ -88,5 +88,16 @@ describe LexicalUnits do
88
88
  subject.words(text).should eq(@array)
89
89
  end
90
90
 
91
+ it "splits text with equals sign into words" do
92
+ text = "Lorem ipsum=dolor sit amet"
93
+
94
+ subject.words(text).should eq(@array)
95
+ end
96
+
97
+ it "splits text with typewriter double quotes into words" do
98
+ text = %Q(Lorem"ipsum dolor"sit amet)
99
+
100
+ subject.words(text).should eq(@array)
101
+ end
91
102
  end
92
103
  end
@@ -0,0 +1,16 @@
1
+ # coding: utf-8
2
+ require 'spec_helper'
3
+
4
+ describe LexicalUnits do
5
+ context ".words_without_digits" do
6
+ [
7
+ {text: "Lorem ipsum 12345", array: %w(Lorem ipsum)},
8
+ {text: "dolor 98765 sit amet.", array: %w(dolor sit amet)}
9
+ ].each do |hash|
10
+ text, array = hash.values
11
+ it "splits text into words without digits" do
12
+ subject.words_without_digits(text).should eq(array)
13
+ end
14
+ end
15
+ end
16
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lexical_units
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aleksander Malaszkiewicz
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-07-15 00:00:00.000000000 Z
11
+ date: 2013-07-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -63,10 +63,12 @@ files:
63
63
  - lib/lexical_units/syllables.rb
64
64
  - lib/lexical_units/version.rb
65
65
  - lib/lexical_units/words.rb
66
+ - lib/lexical_units/words_without_digits.rb
66
67
  - spec/lexical_units/sentences_spec.rb
67
68
  - spec/lexical_units/string_spec.rb
68
69
  - spec/lexical_units/syllables_spec.rb
69
70
  - spec/lexical_units/words_spec.rb
71
+ - spec/lexical_units/words_without_digits_spec.rb
70
72
  - spec/spec_helper.rb
71
73
  homepage: ''
72
74
  licenses:
@@ -97,4 +99,5 @@ test_files:
97
99
  - spec/lexical_units/string_spec.rb
98
100
  - spec/lexical_units/syllables_spec.rb
99
101
  - spec/lexical_units/words_spec.rb
102
+ - spec/lexical_units/words_without_digits_spec.rb
100
103
  - spec/spec_helper.rb