konjak 0.0.11 → 0.0.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/konjak/segment.rb +1 -2
- data/lib/konjak/segment/gtt.rb +1 -2
- data/lib/konjak/version.rb +1 -1
- data/spec/konjak_translate_spec.rb +4 -6
- 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: 2b3737eb910538d760657c5e527b35be1fc9599f
|
4
|
+
data.tar.gz: 85f858f6a152cf53b32e6b831b737d8729712437
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 38622d0a0d77bb334554e0cb5fde0cf8226c1eab06bfec5e86e5a202174c61acd9b83de34ec297299acd4974b1cc85198500591685daaf4e2d7adf77c435ed1f
|
7
|
+
data.tar.gz: bb75de764a2a6722e5435be2f3ca3acd6d39147013630892a8072fadeefadc3bee28f3614327668d98f5843d3ac74756600b1168dfa56def824b70a8253e4430
|
data/lib/konjak/segment.rb
CHANGED
@@ -17,8 +17,7 @@ module Konjak
|
|
17
17
|
|
18
18
|
def compile_pattern
|
19
19
|
regexp = Regexp.escape(text)
|
20
|
-
regexp = regexp.gsub(/(
|
21
|
-
regexp = regexp.gsub(/(\\s\+)+/) {|s| ('\s' * (s.size / '\s+'.size)) + '+' }
|
20
|
+
regexp = regexp.gsub(/(?:\\\s|\n)/m) { '\s' }
|
22
21
|
Regexp.compile(regexp)
|
23
22
|
end
|
24
23
|
|
data/lib/konjak/segment/gtt.rb
CHANGED
@@ -10,8 +10,7 @@ module Konjak
|
|
10
10
|
regexp = regexp.gsub(/\\\{#{n}\\\}/) { "\\k<n#{n}>" }
|
11
11
|
regexp = regexp.gsub(/\\\{\/#{n}\\\}/) { "</\\k<_#{n}>>" }
|
12
12
|
end
|
13
|
-
regexp = regexp.gsub(/(
|
14
|
-
regexp = regexp.gsub(/(\\s\+)+/) {|s| ('\s' * (s.size / '\s+'.size)) + '+' }
|
13
|
+
regexp = regexp.gsub(/(?:\\\s|\n)/m) { '\s' }
|
15
14
|
Regexp.compile(regexp)
|
16
15
|
end
|
17
16
|
|
data/lib/konjak/version.rb
CHANGED
@@ -19,9 +19,8 @@ EXPECT
|
|
19
19
|
|
20
20
|
context 'when blanks between words is not exactly match' do
|
21
21
|
let(:doc) { <<DOC }
|
22
|
-
this is data
|
23
|
-
|
24
|
-
character: ).
|
22
|
+
this is data
|
23
|
+
(with a non-standard character: ).
|
25
24
|
this is data (with a non-standard character: ).
|
26
25
|
DOC
|
27
26
|
|
@@ -54,11 +53,10 @@ EXPECT
|
|
54
53
|
|
55
54
|
context 'when blanks between words is not exactly match' do
|
56
55
|
let(:doc) { <<GTT_HTML }
|
57
|
-
This is
|
56
|
+
This is
|
57
|
+
<a href="http://example.com">example</a>.
|
58
58
|
And This
|
59
59
|
is
|
60
|
-
|
61
|
-
|
62
60
|
<b>example</b>. Yey.
|
63
61
|
And This is example.
|
64
62
|
GTT_HTML
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: konjak
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Seiei Higa
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-06-
|
11
|
+
date: 2015-06-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mem
|