ovec 0.0.6 → 0.0.7
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 +4 -4
- data/TODO +0 -1
- data/lib/ovec/tier.rb +4 -3
- data/lib/ovec/version.rb +1 -1
- data/test/lib/ovec/tier.rb +4 -13
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4b2459b51d262b95de241e84262bc517012ee99a
|
4
|
+
data.tar.gz: 83d33adee0490378adbf4dd6981a729b0c309942
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c384c7ed9ef32b7d9e573cfc27dc5b9601a02a75a18bb6782ee377d17ccb8e14493087cd1c3b3e939b4d4d4fc2193257b02f7cafde02e659b4f683ac4d298ae0
|
7
|
+
data.tar.gz: c70482565d874fb48f556da168f95357028f09031967e796c99519421642637ae61951af3b546d702ddf703d8f5a7e73005c08f5d7ce1c576240b8d8c988aa68
|
data/TODO
CHANGED
data/lib/ovec/tier.rb
CHANGED
@@ -4,9 +4,8 @@ module Ovec
|
|
4
4
|
class Tier < TextManipulator
|
5
5
|
# The last character this regex matches is changed to a tilde.
|
6
6
|
REGEX = /(
|
7
|
-
((\p{Z}|[~\n(
|
8
|
-
([\.\?\!](\p{Z}|\~)+[KSVZOUAI](\p{Z}|\n))| # KSVZOUAI na zacatku vety
|
9
|
-
(\A[KSVZOUAI](\p{Z}|\n))| # KSVZOUAI na zacatku textu
|
7
|
+
((\p{Z}|[~\n(\[\{]|\A)[KkSsVvZzOoUu](\p{Z}|\n|\Z))| # KSVZOU jako samostatne slovo
|
8
|
+
((([\.\?\!](\p{Z}|\~)+)|(\A\p{Z}*))[KSVZOUAI](\p{Z}|\n))| # KSVZOUAI na zacatku vety
|
10
9
|
(\p{Z}(?=--(\p{Z}|\n)))| # mezera, za kterou je pomlcka
|
11
10
|
(,(\p{Z}|\~|\n)+a(\p{Z}|\n)) # ... modulo 10, a~timto prvkem ...; TODO: plati tohle i pro "i"?
|
12
11
|
)/x
|
@@ -43,6 +42,8 @@ module Ovec
|
|
43
42
|
# newline -- move the tied word to the other line.
|
44
43
|
j = change - 1
|
45
44
|
while j >= 0
|
45
|
+
break if @joined[j] == '\n' # Don't cross newlines.
|
46
|
+
|
46
47
|
if @joined[j] == ' '
|
47
48
|
chunk, offset = _find_chunk_and_offset(j)
|
48
49
|
chunk[offset] = '\n'
|
data/lib/ovec/version.rb
CHANGED
data/test/lib/ovec/tier.rb
CHANGED
@@ -8,7 +8,7 @@ module Ovec
|
|
8
8
|
|
9
9
|
private
|
10
10
|
def assert_ties_to(input, output)
|
11
|
-
parser = Ovec::Parser.new(debug:
|
11
|
+
parser = Ovec::Parser.new(debug: false)
|
12
12
|
tree = parser.parse(input.dup)
|
13
13
|
|
14
14
|
tm = Ovec::TexManipulator.new
|
@@ -25,18 +25,7 @@ module Ovec
|
|
25
25
|
def test_basic_without_ties
|
26
26
|
text = "Ahoj. Jak se máš?"
|
27
27
|
text_duplicate = text.dup
|
28
|
-
|
29
|
-
parser = Ovec::Parser.new(debug: true)
|
30
|
-
tree = parser.parse(text)
|
31
|
-
|
32
|
-
tm = Ovec::TexManipulator.new
|
33
|
-
tm.bind(tree)
|
34
|
-
|
35
|
-
tm.run_text_manipulator(@tier)
|
36
|
-
|
37
|
-
text = tree.to_tex
|
38
|
-
|
39
|
-
assert_equal text, text_duplicate
|
28
|
+
assert_ties_to text, text_duplicate
|
40
29
|
end
|
41
30
|
|
42
31
|
def test_simple_tie
|
@@ -80,6 +69,8 @@ module Ovec
|
|
80
69
|
def test_tie_in_newline
|
81
70
|
assert_ties_to "V\nrámci\ntohohle", "V~rámci\ntohohle"
|
82
71
|
assert_ties_to "V\nrámci tohohle", "V~rámci tohohle"
|
72
|
+
assert_ties_to "medved\nv\nulu", "medved\nv~ulu"
|
73
|
+
assert_ties_to "v\nulu", "v~ulu"
|
83
74
|
end
|
84
75
|
|
85
76
|
def test_date_regex_ok
|