konjak 0.0.23 → 0.0.24
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
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9008e7bea949ed8ab532d799a0df321b906fac80
|
4
|
+
data.tar.gz: 48c87e99f9628304f037295b7307a22ad8991e8c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 21fa22c7a920844f05d7877e97620cb1acfb23503c45719cdbbdf1c80865ee6eea22f3d98d86e2f527fce4d6f5c1fca3aadd7997a3ea4afefe76c3ade9cfbf73
|
7
|
+
data.tar.gz: 5f04247db5f844e347d7fb5c02c55724a333a88fe22a60eb3a5358f34127cc07bccff51058413f32b7ef3b61cd88f609122622c2704f9e7d4e86b016c5c00e1f
|
data/lib/konjak/tmx_segmentor.rb
CHANGED
@@ -6,7 +6,7 @@ require 'konjak/tmx_segmentor/segment_string'
|
|
6
6
|
|
7
7
|
module Konjak
|
8
8
|
class TmxSegmentor < Segmentor
|
9
|
-
class
|
9
|
+
class BaseStrategy
|
10
10
|
Edge = Struct.new(:prev, :current)
|
11
11
|
Node = Struct.new(:range, :segments) do
|
12
12
|
def <=>(other)
|
@@ -123,9 +123,10 @@ module Konjak
|
|
123
123
|
|
124
124
|
def default_options
|
125
125
|
{
|
126
|
-
|
127
|
-
|
128
|
-
select_next_segment:
|
126
|
+
calc_edge_cost: -> (edge) { edge.current.max_segment_size },
|
127
|
+
compile_pattern: -> (segment) { segment.compile_pattern },
|
128
|
+
select_next_segment: -> (_, node) { node.segments.first },
|
129
|
+
translation_unit_filter: -> (tu) { true },
|
129
130
|
}
|
130
131
|
end
|
131
132
|
|
@@ -133,6 +134,10 @@ module Konjak
|
|
133
134
|
@options[:calc_edge_cost].call(edge)
|
134
135
|
end
|
135
136
|
|
137
|
+
def compile_pattern(segment)
|
138
|
+
@options[:compile_pattern].call(segment)
|
139
|
+
end
|
140
|
+
|
136
141
|
def translation_unit_filter
|
137
142
|
@options[:translation_unit_filter]
|
138
143
|
end
|
@@ -1,14 +1,14 @@
|
|
1
1
|
require 'konjak/tmx_segmentor/segment_string'
|
2
|
-
require 'konjak/tmx_segmentor/
|
2
|
+
require 'konjak/tmx_segmentor/base_strategy'
|
3
3
|
|
4
4
|
module Konjak
|
5
5
|
class TmxSegmentor < Segmentor
|
6
|
-
class GttHtmlStrategy <
|
6
|
+
class GttHtmlStrategy < BaseStrategy
|
7
7
|
|
8
8
|
private
|
9
9
|
|
10
|
-
def
|
11
|
-
segment.compile_gtt_html_pattern
|
10
|
+
def default_options
|
11
|
+
super.merge(compile_pattern: -> (segment) { segment.compile_gtt_html_pattern })
|
12
12
|
end
|
13
13
|
end
|
14
14
|
end
|
@@ -1,15 +1,9 @@
|
|
1
1
|
require 'konjak/tmx_segmentor/segment_string'
|
2
|
-
require 'konjak/tmx_segmentor/
|
2
|
+
require 'konjak/tmx_segmentor/base_strategy'
|
3
3
|
|
4
4
|
module Konjak
|
5
5
|
class TmxSegmentor < Segmentor
|
6
|
-
class TextStrategy <
|
7
|
-
|
8
|
-
private
|
9
|
-
|
10
|
-
def compile_pattern(segment)
|
11
|
-
segment.compile_pattern
|
12
|
-
end
|
6
|
+
class TextStrategy < BaseStrategy
|
13
7
|
end
|
14
8
|
end
|
15
9
|
end
|
data/lib/konjak/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
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.24
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Seiei Higa
|
@@ -177,9 +177,9 @@ files:
|
|
177
177
|
- lib/konjak/sub_flow.rb
|
178
178
|
- lib/konjak/tmx.rb
|
179
179
|
- lib/konjak/tmx_segmentor.rb
|
180
|
+
- lib/konjak/tmx_segmentor/base_strategy.rb
|
180
181
|
- lib/konjak/tmx_segmentor/gtt_html_strategy.rb
|
181
182
|
- lib/konjak/tmx_segmentor/segment_string.rb
|
182
|
-
- lib/konjak/tmx_segmentor/strategy.rb
|
183
183
|
- lib/konjak/tmx_segmentor/text_strategy.rb
|
184
184
|
- lib/konjak/translation_unit.rb
|
185
185
|
- lib/konjak/translation_unit_variant.rb
|