byk 0.1.0 → 0.2.0
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 +13 -5
- data/README.md +20 -11
- data/ext/byk/byk.c +15 -1
- data/lib/byk/version.rb +1 -1
- metadata +9 -9
checksums.yaml
CHANGED
@@ -1,7 +1,15 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
YmZiNDc2ZGE5NDBiZjE0ZTU1ZDk2ODg2NGU2MWExNzM0OTE4YTc5ZQ==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
MjVhNGVjOTQ0MTI5NTY3YzBiZWY2MmYwYTM4YzdlM2U3OTUyOWI4YQ==
|
5
7
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
N2I2NzgxY2QzYjk3MDlmMWVmOTAwOWI0ZDViNjk0NTBjYjQwM2U1YjJiY2M3
|
10
|
+
MmQyNDE1YmIxOTExMTNiMGE4ZDQ3OGVmOGZlOWRlNTUyODM0NDU4YzgxNzRl
|
11
|
+
OTAyYzc2YzEyNDQ0NjgwNzRhMWQ4MGExOWE1ZjFiMGM3MzQzZDI=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
OGUyM2RiZDdjYjA4NjQ0YmM3MTE5YjhjOWZjNGQxZTliZGI1NTdmMWRmYmEx
|
14
|
+
OTQ2YWQxYmM3ZjdmZmNhM2M0NmVkYTEwNDM3YzE3ZmUyMzM4ODhjMTM2MGI3
|
15
|
+
MWE5MjlkNGNjZWUzN2YwOTUyYzRmYWJmY2FjNWYwOGY5ZmM4ODc=
|
data/README.md
CHANGED
@@ -3,6 +3,8 @@ Byk
|
|
3
3
|
|
4
4
|
Fast transliteration of Serbian Cyrillic into Latin.
|
5
5
|
|
6
|
+

|
7
|
+
|
6
8
|
This package was inspired by @dejan's
|
7
9
|
[nice little gem](https://github.com/dejan/srbovanje), but this one
|
8
10
|
comes with a C-optimized twist.
|
@@ -22,6 +24,7 @@ $ bundle
|
|
22
24
|
```
|
23
25
|
|
24
26
|
Or install it yourself as:
|
27
|
+
|
25
28
|
```
|
26
29
|
$ gem install byk
|
27
30
|
```
|
@@ -55,23 +58,16 @@ text # => "Zvazbuka"
|
|
55
58
|
Note that these methods will take into account the
|
56
59
|
[special two-letter rules](http://sr.wikipedia.org/wiki/Gajica#Abeceda):
|
57
60
|
|
58
|
-
```
|
61
|
+
```ruby
|
59
62
|
"ĐORĐE Đorđević".to_ascii_latin # => "DJORDJE Djordjevic"
|
60
63
|
```
|
61
64
|
|
62
|
-
##
|
65
|
+
## How fast is fast?
|
63
66
|
|
64
|
-
|
65
|
-
|
66
|
-
About [7x](benchmark) faster than the baseline Ruby implementation on
|
67
|
+
About [7x faster](benchmark) than the baseline Ruby implementation on
|
67
68
|
my hardware. YMMV of course.
|
68
69
|
|
69
|
-
|
70
|
-
|
71
|
-
Byk is supported under MRI Ruby 1.9.3, 2.0, 2.1 and 2.2. Earlier
|
72
|
-
versions of MRI are untested.
|
73
|
-
|
74
|
-
### Raison d'être
|
70
|
+
## Raison d'être
|
75
71
|
|
76
72
|
For massive transliteration (e.g. sites supporting dual script
|
77
73
|
output), this kind of speed-up might be worthwhile, even with caching.
|
@@ -80,4 +76,17 @@ Also, it's a well-defined problem with hard-set rules which makes it a
|
|
80
76
|
natural target for optimization. Plus, it gave me an excuse to play
|
81
77
|
with Ruby extensions, so there :smile_cat:
|
82
78
|
|
79
|
+
## Compatibility
|
80
|
+
|
81
|
+
Byk is supported under MRI Ruby 1.9.3, 2.0, 2.1 and 2.2. Earlier
|
82
|
+
versions of MRI are untested (yet).
|
83
|
+
|
84
|
+
## Code Status
|
85
|
+
|
86
|
+
[](https://travis-ci.org/topalovic/byk)
|
87
|
+
|
88
|
+
## License
|
89
|
+
|
90
|
+
This gem is released under the [MIT License](http://www.opensource.org/licenses/MIT).
|
91
|
+
|
83
92
|
Уздравље!
|
data/ext/byk/byk.c
CHANGED
@@ -2,6 +2,19 @@
|
|
2
2
|
#include <ruby.h>
|
3
3
|
#include <ruby/encoding.h>
|
4
4
|
|
5
|
+
#ifndef rb_check_arity
|
6
|
+
#define rb_check_arity rb_check_arity
|
7
|
+
|
8
|
+
NORETURN(void rb_error_arity(int, int, int));
|
9
|
+
|
10
|
+
static inline void
|
11
|
+
rb_check_arity(int argc, int min, int max)
|
12
|
+
{
|
13
|
+
if ((argc < min) || (max != -1 && argc > max))
|
14
|
+
rb_error_arity(argc, min, max);
|
15
|
+
}
|
16
|
+
#endif
|
17
|
+
|
5
18
|
#define STR_ENC_GET(str) rb_enc_from_index(ENCODING_GET(str))
|
6
19
|
|
7
20
|
#define STR_CAT_COND_ASCII(force_ascii, dest, chr, ascii_chr, len, enc) \
|
@@ -126,7 +139,8 @@ str_to_latin(int argc, VALUE *argv, VALUE str, int ascii, int bang)
|
|
126
139
|
rb_enc_associate(dest, enc);
|
127
140
|
|
128
141
|
while (pos < end) {
|
129
|
-
int len
|
142
|
+
int len;
|
143
|
+
int force_upper = 0;
|
130
144
|
|
131
145
|
prev_codepoint = codepoint;
|
132
146
|
codepoint = rb_enc_codepoint_len(pos, end, &len, enc);
|
data/lib/byk/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: byk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nikola Topalović
|
@@ -14,28 +14,28 @@ dependencies:
|
|
14
14
|
name: rake-compiler
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ~>
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0.9'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ~>
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0.9'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rspec
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ~>
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '3.2'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ~>
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '3.2'
|
41
41
|
description: Provides C-optimized methods for transliteration of Serbian Cyrillic
|
@@ -63,17 +63,17 @@ require_paths:
|
|
63
63
|
- lib
|
64
64
|
required_ruby_version: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - ! '>='
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version:
|
68
|
+
version: 1.9.3
|
69
69
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
70
70
|
requirements:
|
71
|
-
- -
|
71
|
+
- - ! '>='
|
72
72
|
- !ruby/object:Gem::Version
|
73
73
|
version: '0'
|
74
74
|
requirements: []
|
75
75
|
rubyforge_project:
|
76
|
-
rubygems_version: 2.
|
76
|
+
rubygems_version: 2.4.6
|
77
77
|
signing_key:
|
78
78
|
specification_version: 4
|
79
79
|
summary: Fast transliteration of Serbian Cyrillic into Latin.
|