tracinho 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +13 -0
- data/.travis.yml +1 -4
- data/Gemfile +2 -0
- data/Gemfile.lock +46 -42
- data/Rakefile +2 -0
- data/bin/console +10 -0
- data/lib/tracinho/complement_builder.rb +5 -3
- data/lib/tracinho/version.rb +3 -1
- data/lib/tracinho/word.rb +19 -0
- data/lib/tracinho/word_classifier.rb +3 -1
- data/lib/tracinho.rb +2 -0
- data/spec/complement_builder_spec.rb +4 -2
- data/spec/spec_helper.rb +2 -0
- data/spec/word_classifier_spec.rb +7 -5
- data/spec/word_spec.rb +4 -2
- data/tracinho.gemspec +8 -6
- metadata +34 -32
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6ac4ff2efca57bb861585d8e88b14959e4b743d9
|
4
|
+
data.tar.gz: e470af0a0a0ea736f115612e68856154b547e7f6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ca4ce4573245f60ae3eda72dfac119472af947c6d3458514685dc1efeccd50f140d6a0d495a56a2d5bcb50801d71184cd620ef78617d6456727e36b4a27af845
|
7
|
+
data.tar.gz: 61531fd654f16be289f7d2ece845cacd77552602174eeb8052083621a604fb9712dc7c22e275615aa796b3ed47cfd342966a2462903db82c8a43ba652fe81808
|
data/.rubocop.yml
CHANGED
@@ -1,2 +1,15 @@
|
|
1
1
|
Metrics/LineLength:
|
2
2
|
Max: 100
|
3
|
+
|
4
|
+
# We have a lot of portuguese examples in the comments so...
|
5
|
+
Style/AsciiComments:
|
6
|
+
Enabled: false
|
7
|
+
|
8
|
+
# The default (10) is too litle
|
9
|
+
Metrics/MethodLength:
|
10
|
+
Max: 15
|
11
|
+
|
12
|
+
# Blocks in spec files get big
|
13
|
+
Metrics/BlockLength:
|
14
|
+
Exclude:
|
15
|
+
- 'spec/**'
|
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,66 +1,70 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
tracinho (0.1.
|
4
|
+
tracinho (0.1.2)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
8
8
|
specs:
|
9
|
-
ast (2.
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
diff-lcs (1.2.5)
|
9
|
+
ast (2.3.0)
|
10
|
+
byebug (9.1.0)
|
11
|
+
coderay (1.1.2)
|
12
|
+
diff-lcs (1.3)
|
14
13
|
docile (1.1.5)
|
15
|
-
json (1.
|
16
|
-
method_source (0.
|
17
|
-
|
18
|
-
|
14
|
+
json (2.1.0)
|
15
|
+
method_source (0.9.0)
|
16
|
+
parallel (1.12.0)
|
17
|
+
parser (2.4.0.0)
|
18
|
+
ast (~> 2.2)
|
19
19
|
powerpack (0.1.1)
|
20
|
-
pry (0.
|
20
|
+
pry (0.11.2)
|
21
21
|
coderay (~> 1.1.0)
|
22
|
-
method_source (~> 0.
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
rspec-
|
32
|
-
|
22
|
+
method_source (~> 0.9.0)
|
23
|
+
pry-byebug (3.5.0)
|
24
|
+
byebug (~> 9.1)
|
25
|
+
pry (~> 0.10)
|
26
|
+
rainbow (2.2.2)
|
27
|
+
rake
|
28
|
+
rake (12.1.0)
|
29
|
+
rspec (3.7.0)
|
30
|
+
rspec-core (~> 3.7.0)
|
31
|
+
rspec-expectations (~> 3.7.0)
|
32
|
+
rspec-mocks (~> 3.7.0)
|
33
|
+
rspec-core (3.7.0)
|
34
|
+
rspec-support (~> 3.7.0)
|
35
|
+
rspec-expectations (3.7.0)
|
33
36
|
diff-lcs (>= 1.2.0, < 2.0)
|
34
|
-
rspec-support (~> 3.
|
35
|
-
rspec-mocks (3.
|
37
|
+
rspec-support (~> 3.7.0)
|
38
|
+
rspec-mocks (3.7.0)
|
36
39
|
diff-lcs (>= 1.2.0, < 2.0)
|
37
|
-
rspec-support (~> 3.
|
38
|
-
rspec-support (3.
|
39
|
-
rubocop (0.
|
40
|
-
|
41
|
-
parser (>= 2.
|
40
|
+
rspec-support (~> 3.7.0)
|
41
|
+
rspec-support (3.7.0)
|
42
|
+
rubocop (0.51.0)
|
43
|
+
parallel (~> 1.10)
|
44
|
+
parser (>= 2.3.3.1, < 3.0)
|
42
45
|
powerpack (~> 0.1)
|
43
|
-
rainbow (>=
|
46
|
+
rainbow (>= 2.2.2, < 3.0)
|
44
47
|
ruby-progressbar (~> 1.7)
|
45
|
-
|
46
|
-
|
48
|
+
unicode-display_width (~> 1.0, >= 1.0.1)
|
49
|
+
ruby-progressbar (1.9.0)
|
50
|
+
simplecov (0.15.1)
|
47
51
|
docile (~> 1.1.0)
|
48
|
-
json (
|
52
|
+
json (>= 1.8, < 3)
|
49
53
|
simplecov-html (~> 0.10.0)
|
50
|
-
simplecov-html (0.10.
|
51
|
-
|
54
|
+
simplecov-html (0.10.2)
|
55
|
+
unicode-display_width (1.3.0)
|
52
56
|
|
53
57
|
PLATFORMS
|
54
58
|
ruby
|
55
59
|
|
56
60
|
DEPENDENCIES
|
57
|
-
bundler
|
58
|
-
pry
|
59
|
-
rake
|
60
|
-
rspec
|
61
|
-
rubocop
|
62
|
-
simplecov
|
61
|
+
bundler
|
62
|
+
pry-byebug
|
63
|
+
rake
|
64
|
+
rspec
|
65
|
+
rubocop
|
66
|
+
simplecov
|
63
67
|
tracinho!
|
64
68
|
|
65
69
|
BUNDLED WITH
|
66
|
-
1.
|
70
|
+
1.15.4
|
data/Rakefile
CHANGED
data/bin/console
ADDED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Tracinho
|
2
4
|
# ComplementBuilder converts words with dash in the version without it and vice-versa.
|
3
5
|
class ComplementBuilder
|
@@ -21,15 +23,15 @@ module Tracinho
|
|
21
23
|
private
|
22
24
|
|
23
25
|
def remove_dash(text)
|
24
|
-
text.match(/\-se$/) ? text.tr('-', 's') : text.delete('-')
|
26
|
+
text.match?(/\-se$/) ? text.dup.tr('-', 's') : text.dup.delete('-')
|
25
27
|
end
|
26
28
|
|
27
29
|
def add_dash(text)
|
28
30
|
case text
|
29
31
|
when /os$/
|
30
|
-
text.insert(-4, '-')
|
32
|
+
text.dup.insert(-4, '-')
|
31
33
|
else
|
32
|
-
text.insert(-3, '-')
|
34
|
+
text.dup.insert(-3, '-')
|
33
35
|
end
|
34
36
|
end
|
35
37
|
end
|
data/lib/tracinho/version.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# This gem converts words with dash in the version without it and vice-versa. It also gets the verb
|
2
4
|
# name from a word and gives the full grammar classification of the verb.
|
3
5
|
module Tracinho
|
4
|
-
VERSION = '0.1.
|
6
|
+
VERSION = '0.1.2'
|
5
7
|
end
|
data/lib/tracinho/word.rb
CHANGED
@@ -1,13 +1,32 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Tracinho
|
4
|
+
# Word is the class that represents a word (duh!). It includes some methods to quickly get the
|
5
|
+
# complement word or the classification.
|
6
|
+
#
|
7
|
+
# Example:
|
8
|
+
#
|
9
|
+
# word = Tracinho::Word.new('comeste')
|
10
|
+
#
|
11
|
+
# word.hyphenated?
|
12
|
+
# # => false
|
13
|
+
#
|
14
|
+
# word.complement
|
15
|
+
# # => "comes-te"
|
16
|
+
#
|
17
|
+
# word.grammar_class
|
18
|
+
# # => "Segunda pessoa do singular do pretérito perfeito do indicativo do verbo comer."
|
2
19
|
class Word
|
3
20
|
def initialize(text)
|
4
21
|
@text = text
|
5
22
|
end
|
6
23
|
|
24
|
+
# Returns true if the word as a hyphen (the '-' character) or false otherwise.
|
7
25
|
def hyphenated?
|
8
26
|
@text.include?('-')
|
9
27
|
end
|
10
28
|
|
29
|
+
# Returns the complement of the word.
|
11
30
|
def complement
|
12
31
|
ComplementBuilder.new(self).build
|
13
32
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Tracinho
|
2
4
|
# WordClassifier is the responsible for classifying a word. It gives the verb, the verb tense and
|
3
5
|
# the full classification of a Word.
|
@@ -28,7 +30,7 @@ module Tracinho
|
|
28
30
|
#
|
29
31
|
# classifier = Tracinho::WordClassifier.new(word)
|
30
32
|
# classifier.full_classification
|
31
|
-
# # => "Conjugação pronominal reflexa da segunda pessoa do presente do
|
33
|
+
# # => "Conjugação pronominal reflexa da segunda pessoa do presente do indicat..."
|
32
34
|
def full_classification
|
33
35
|
case @word.to_s
|
34
36
|
when /ste$/
|
data/lib/tracinho.rb
CHANGED
@@ -1,8 +1,10 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'spec_helper'
|
2
4
|
|
3
5
|
describe ComplementBuilder do
|
4
|
-
let(:hyphenated) { %w
|
5
|
-
let(:not_hyphenated) { %w
|
6
|
+
let(:hyphenated) { %w[passa-mos cala-te matas-te conhecer-te morde-mos mata-te] }
|
7
|
+
let(:not_hyphenated) { %w[passamos calate mataste conhecerte mordemos matate] }
|
6
8
|
|
7
9
|
describe '#build' do
|
8
10
|
it 'complements hyphenated words correctly' do
|
data/spec/spec_helper.rb
CHANGED
@@ -1,21 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'spec_helper'
|
2
4
|
|
3
5
|
describe WordClassifier do
|
4
6
|
describe 'verb' do
|
5
7
|
let(:regular_words) do
|
6
|
-
%w
|
8
|
+
%w[bebemos comesse mijaste cagou-se passa-mos cala-te matas-te conhecer-te morde-mos mata-te]
|
7
9
|
end
|
8
10
|
|
9
11
|
let(:regular_verbs) do
|
10
|
-
%w
|
12
|
+
%w[beber comer mijar cagar passar calar matar conhecer morder matar]
|
11
13
|
end
|
12
14
|
|
13
15
|
let(:irregular_words) do
|
14
|
-
%w
|
16
|
+
%w[vamos somos fomos]
|
15
17
|
end
|
16
18
|
|
17
19
|
let(:irregular_verbs) do
|
18
|
-
%w
|
20
|
+
%w[ir ser ser]
|
19
21
|
end
|
20
22
|
|
21
23
|
context 'for regular verbs' do
|
@@ -51,7 +53,7 @@ describe WordClassifier do
|
|
51
53
|
]
|
52
54
|
end
|
53
55
|
|
54
|
-
%w
|
56
|
+
%w[mijaste bebesse conhecemos busca-mos].each_with_index do |word, index|
|
55
57
|
it "correctly returns the full classification of the word '#{word}'" do
|
56
58
|
classifier = described_class.new(Word.new(word))
|
57
59
|
|
data/spec/word_spec.rb
CHANGED
@@ -1,8 +1,10 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'spec_helper'
|
2
4
|
|
3
5
|
describe Word do
|
4
|
-
let(:hyphenated) { %w
|
5
|
-
let(:not_hyphenated) { %w
|
6
|
+
let(:hyphenated) { %w[passa-mos cala-te matas-te conhecer-te morde-mos mata-te] }
|
7
|
+
let(:not_hyphenated) { %w[passamos calate mataste conhecerte mordemos matate] }
|
6
8
|
|
7
9
|
describe '#hyphenated?' do
|
8
10
|
it 'returns true if the word has a hyphen' do
|
data/tracinho.gemspec
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
lib = File.expand_path('../lib', __FILE__)
|
2
4
|
|
3
5
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
@@ -21,10 +23,10 @@ Gem::Specification.new do |spec|
|
|
21
23
|
spec.test_files = spec.files.grep(%r{^spec/})
|
22
24
|
spec.require_paths = ['lib']
|
23
25
|
|
24
|
-
spec.add_development_dependency 'bundler'
|
25
|
-
spec.add_development_dependency '
|
26
|
-
spec.add_development_dependency '
|
27
|
-
spec.add_development_dependency '
|
28
|
-
spec.add_development_dependency '
|
29
|
-
spec.add_development_dependency 'simplecov'
|
26
|
+
spec.add_development_dependency 'bundler'
|
27
|
+
spec.add_development_dependency 'pry-byebug'
|
28
|
+
spec.add_development_dependency 'rake'
|
29
|
+
spec.add_development_dependency 'rspec'
|
30
|
+
spec.add_development_dependency 'rubocop'
|
31
|
+
spec.add_development_dependency 'simplecov'
|
30
32
|
end
|
metadata
CHANGED
@@ -1,106 +1,107 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tracinho
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ricardo Otero
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-10-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '0'
|
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
|
-
version: '
|
26
|
+
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: pry-byebug
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '0'
|
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
|
-
version: '
|
40
|
+
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: rake
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '0
|
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
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '0
|
54
|
+
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
56
|
+
name: rspec
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - "
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '0
|
61
|
+
version: '0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - "
|
66
|
+
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '0
|
68
|
+
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
70
|
+
name: rubocop
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - "
|
73
|
+
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: '
|
75
|
+
version: '0'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- - "
|
80
|
+
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: '
|
82
|
+
version: '0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: simplecov
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- - "
|
87
|
+
- - ">="
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: '0
|
89
|
+
version: '0'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- - "
|
94
|
+
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: '0
|
96
|
+
version: '0'
|
97
97
|
description: |-
|
98
98
|
This gem converts words with dash in the version without it and vice-versa.
|
99
99
|
It also gets the verb name from a word and gives the full grammar
|
100
100
|
classification of the verb.
|
101
101
|
email:
|
102
102
|
- oterosantos@gmail.com
|
103
|
-
executables:
|
103
|
+
executables:
|
104
|
+
- console
|
104
105
|
extensions: []
|
105
106
|
extra_rdoc_files: []
|
106
107
|
files:
|
@@ -113,6 +114,7 @@ files:
|
|
113
114
|
- LICENSE
|
114
115
|
- README.md
|
115
116
|
- Rakefile
|
117
|
+
- bin/console
|
116
118
|
- lib/tracinho.rb
|
117
119
|
- lib/tracinho/complement_builder.rb
|
118
120
|
- lib/tracinho/version.rb
|
@@ -143,7 +145,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
143
145
|
version: '0'
|
144
146
|
requirements: []
|
145
147
|
rubyforge_project:
|
146
|
-
rubygems_version: 2.
|
148
|
+
rubygems_version: 2.6.13
|
147
149
|
signing_key:
|
148
150
|
specification_version: 4
|
149
151
|
summary: Tracinho.com gem.
|