rtatoeba 0.0.1 → 0.0.2
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/.travis.yml +6 -0
- data/README.md +1 -0
- data/Rakefile +7 -0
- data/lib/rtatoeba/version.rb +1 -1
- data/lib/rtatoeba.rb +3 -9
- data/rtatoeba.gemspec +2 -0
- data/spec/lib/rtatoeba_spec.rb +26 -0
- data/spec/spec_helper.rb +19 -0
- metadata +33 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4e090f73ff562906da45d9cdb405933cb6fd3447
|
4
|
+
data.tar.gz: 93a0733ed61cc8d0e3c60b50a3f77a080c13946d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b2e78e8b8743e8bec33a45f1e491f84f5be18ef2c32fe265e3a03a99fecfb534f7fb8cffac121fa1ea9debcf37d4e96fb7249af5f5a6fb8eb0caf3653637c367
|
7
|
+
data.tar.gz: 812b652ee17342703941ed470fe84fd8460b11a50412174f6daa19af85a7c90f299d93ec5f9bbdeb2d44ce8468521175eecdbce55bd528eb32937d1bf5b0e87a
|
data/.travis.yml
ADDED
data/README.md
CHANGED
data/Rakefile
CHANGED
data/lib/rtatoeba/version.rb
CHANGED
data/lib/rtatoeba.rb
CHANGED
@@ -33,15 +33,9 @@ module Rtatoeba
|
|
33
33
|
content =
|
34
34
|
@agent.get("http://tatoeba.org/eng/sentences/search?query=#{@query}&from=#{@from}&to=#{@to}")
|
35
35
|
sentences = {}
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
if s.node.parent.parent['class'] =~ /mainSentence/
|
40
|
-
sentences[s.text] ||= []
|
41
|
-
mainSentence = s.text
|
42
|
-
else
|
43
|
-
(sentences[mainSentence] ||= []) << s.text
|
44
|
-
end
|
36
|
+
content.search('.sentences_set').map do |set|
|
37
|
+
translations = set.search('.sentenceContent').map{|x| x.text.strip}.drop(1)
|
38
|
+
sentences[set.at('.mainSentence').text.strip] = translations
|
45
39
|
end
|
46
40
|
sentences
|
47
41
|
end
|
data/rtatoeba.gemspec
CHANGED
@@ -0,0 +1,26 @@
|
|
1
|
+
# -*- encoding : utf-8 -*-
|
2
|
+
#
|
3
|
+
# DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
4
|
+
# Version 2, December 2004
|
5
|
+
#
|
6
|
+
# Copyright (C) 2004 Sam Hocevar
|
7
|
+
# 14 rue de Plaisance, 75014 Paris, France
|
8
|
+
# Everyone is permitted to copy and distribute verbatim or modified
|
9
|
+
# copies of this license document, and changing it is allowed as long
|
10
|
+
# as the name is changed.
|
11
|
+
# DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
12
|
+
# TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
13
|
+
# 0. You just DO WHAT THE FUCK YOU WANT TO.
|
14
|
+
#
|
15
|
+
#
|
16
|
+
# David Hagege <david.hagege@gmail.com>
|
17
|
+
#
|
18
|
+
|
19
|
+
require 'spec_helper'
|
20
|
+
|
21
|
+
describe Rtatoeba do
|
22
|
+
it "should return sample sentences" do
|
23
|
+
tatoe = Rtatoeba::Rtatoeba.new(from: 'eng', to: 'kor', query: 'hello')
|
24
|
+
expect(tatoe.sentences).not_to be_empty
|
25
|
+
end
|
26
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
# -*- encoding : utf-8 -*-
|
2
|
+
#
|
3
|
+
# DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
4
|
+
# Version 2, December 2004
|
5
|
+
#
|
6
|
+
# Copyright (C) 2004 Sam Hocevar
|
7
|
+
# 14 rue de Plaisance, 75014 Paris, France
|
8
|
+
# Everyone is permitted to copy and distribute verbatim or modified
|
9
|
+
# copies of this license document, and changing it is allowed as long
|
10
|
+
# as the name is changed.
|
11
|
+
# DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
12
|
+
# TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
13
|
+
# 0. You just DO WHAT THE FUCK YOU WANT TO.
|
14
|
+
#
|
15
|
+
#
|
16
|
+
# David Hagege <david.hagege@gmail.com>
|
17
|
+
#
|
18
|
+
|
19
|
+
require 'rtatoeba'
|
metadata
CHANGED
@@ -1,55 +1,69 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rtatoeba
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Hagege
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-09-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mechanize
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0'
|
20
20
|
type: :runtime
|
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'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - ~>
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '1.3'
|
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: '1.3'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rake
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
53
67
|
- !ruby/object:Gem::Version
|
54
68
|
version: '0'
|
55
69
|
description: Tiny gem to get sample sentences from tatoeba.org
|
@@ -59,7 +73,8 @@ executables: []
|
|
59
73
|
extensions: []
|
60
74
|
extra_rdoc_files: []
|
61
75
|
files:
|
62
|
-
- .gitignore
|
76
|
+
- ".gitignore"
|
77
|
+
- ".travis.yml"
|
63
78
|
- Gemfile
|
64
79
|
- LICENSE.txt
|
65
80
|
- README.md
|
@@ -67,6 +82,8 @@ files:
|
|
67
82
|
- lib/rtatoeba.rb
|
68
83
|
- lib/rtatoeba/version.rb
|
69
84
|
- rtatoeba.gemspec
|
85
|
+
- spec/lib/rtatoeba_spec.rb
|
86
|
+
- spec/spec_helper.rb
|
70
87
|
homepage: ''
|
71
88
|
licenses:
|
72
89
|
- WTFPL
|
@@ -77,18 +94,21 @@ require_paths:
|
|
77
94
|
- lib
|
78
95
|
required_ruby_version: !ruby/object:Gem::Requirement
|
79
96
|
requirements:
|
80
|
-
- -
|
97
|
+
- - ">="
|
81
98
|
- !ruby/object:Gem::Version
|
82
99
|
version: '0'
|
83
100
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
84
101
|
requirements:
|
85
|
-
- -
|
102
|
+
- - ">="
|
86
103
|
- !ruby/object:Gem::Version
|
87
104
|
version: '0'
|
88
105
|
requirements: []
|
89
106
|
rubyforge_project:
|
90
|
-
rubygems_version: 2.
|
107
|
+
rubygems_version: 2.4.6
|
91
108
|
signing_key:
|
92
109
|
specification_version: 4
|
93
110
|
summary: ''
|
94
|
-
test_files:
|
111
|
+
test_files:
|
112
|
+
- spec/lib/rtatoeba_spec.rb
|
113
|
+
- spec/spec_helper.rb
|
114
|
+
has_rdoc:
|