charyf 0.2.5 → 0.2.6
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/Gemfile.lock +1 -1
- data/lib/charyf/utils/all.rb +0 -3
- data/lib/charyf/utils/application.rb +0 -7
- data/lib/charyf/utils/application/bootstrap.rb +0 -10
- data/lib/charyf/utils/generators/app_base.rb +5 -6
- data/lib/charyf/utils/generators/defaults.rb +1 -1
- data/lib/charyf/utils/storage/provider.rb +1 -0
- data/lib/charyf/version.rb +1 -1
- metadata +2 -4
- data/lib/charyf/utils/parser/en_parser.rb +0 -97
- data/lib/charyf/utils/parser/parser.rb +0 -30
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 85268dbf6cc1d03b50cd87fb6d04c07fb618103e
|
4
|
+
data.tar.gz: 5c5e9fb065243a0baa7066c59c6d5cd475322d90
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 836bbf92eeb0cd151cee5cee6d2954849bd70d7e3f905f24c7fdb3ea585f069dfd85e5b14dba6b4fa2ec535edfe83430cac62a10591c14ba7cd475844a7e2e3f
|
7
|
+
data.tar.gz: ac7f674be428d48b48720ba5dd04d5284aac5e26c3a90db0ad1afd4bd5158bfea06631c0c9cddc2f5662b28239df1d5ad5e8bf82610f9bc432d59ad0af7fa121
|
data/Gemfile.lock
CHANGED
data/lib/charyf/utils/all.rb
CHANGED
@@ -103,13 +103,6 @@ module Charyf
|
|
103
103
|
klass
|
104
104
|
end
|
105
105
|
|
106
|
-
def parser
|
107
|
-
klass = Charyf::Utils::Parser.get(config.i18n.locale)
|
108
|
-
raise Charyf::Utils::InvalidConfiguration.new("No parser for locale '#{config.i18n.locale}' found") unless klass
|
109
|
-
|
110
|
-
klass
|
111
|
-
end
|
112
|
-
|
113
106
|
def routing
|
114
107
|
klass = Charyf::Engine::Routing.list[config.router]
|
115
108
|
|
@@ -44,16 +44,6 @@ module Charyf
|
|
44
44
|
I18n.load_path << Dir[Charyf._gem_source.join('locale', '**', '*.yml').to_s]
|
45
45
|
end
|
46
46
|
|
47
|
-
#
|
48
|
-
# Validates that all required strategies are fulfilled and the application can load
|
49
|
-
#
|
50
|
-
initializer :validate_strategies, group: :all do
|
51
|
-
Charyf.application.session_processor
|
52
|
-
Charyf.application.intent_processors
|
53
|
-
Charyf.application.dispatcher
|
54
|
-
Charyf.application.routing
|
55
|
-
end
|
56
|
-
|
57
47
|
#
|
58
48
|
# Load APP default files
|
59
49
|
#
|
@@ -41,11 +41,11 @@ module Charyf
|
|
41
41
|
|
42
42
|
def self.add_shared_options_for(name)
|
43
43
|
|
44
|
-
class_option :intent_processors, type: :array,
|
44
|
+
class_option :intent_processors, type: :array, default: Defaults::SETTINGS[:intents],
|
45
45
|
desc: "Set of intent intent processors to be included in installation" + Defaults.intents_desc,
|
46
46
|
group: :strategies
|
47
47
|
|
48
|
-
class_option :storage_provider, type: :string,
|
48
|
+
class_option :storage_provider, type: :string, default: Defaults::SETTINGS[:storage],
|
49
49
|
desc: "Storage provider to be installed by default." + Defaults.storage_desc,
|
50
50
|
group: :strategies
|
51
51
|
|
@@ -208,15 +208,14 @@ module Charyf
|
|
208
208
|
end
|
209
209
|
|
210
210
|
def intents_gemfile_entries
|
211
|
-
|
211
|
+
intents_details.values.map do |details|
|
212
212
|
GemfileEntry.version(details[:gem], details[:gem_version], 'Intent processor [generated]')
|
213
213
|
end
|
214
214
|
end
|
215
215
|
|
216
216
|
def storage_gemfile_entries
|
217
|
-
|
218
|
-
|
219
|
-
end
|
217
|
+
details = storage_details
|
218
|
+
GemfileEntry.version(details[:gem], details[:gem_version], 'Storage provider [generated]')
|
220
219
|
end
|
221
220
|
|
222
221
|
def charyf_version_specifier(gem_version = Charyf.gem_version)
|
@@ -24,7 +24,7 @@ Should not be used on production environments as it is not persisted.
|
|
24
24
|
INTENT_PROCESSORS = {
|
25
25
|
adapt: {
|
26
26
|
gem: 'adapt-charyf',
|
27
|
-
gem_version: ['>= 0.
|
27
|
+
gem_version: ['>= 0.3'],
|
28
28
|
require: 'adapt-charyf',
|
29
29
|
desc: <<-EOM
|
30
30
|
Ruby wrapper around python library from mycroft [adapt]. Works offline.
|
data/lib/charyf/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: charyf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Richard Ludvigh
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-04-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: charyf_sig
|
@@ -240,8 +240,6 @@ files:
|
|
240
240
|
- lib/charyf/utils/initializable.rb
|
241
241
|
- lib/charyf/utils/logger.rb
|
242
242
|
- lib/charyf/utils/machine.rb
|
243
|
-
- lib/charyf/utils/parser/en_parser.rb
|
244
|
-
- lib/charyf/utils/parser/parser.rb
|
245
243
|
- lib/charyf/utils/pipeline.rb
|
246
244
|
- lib/charyf/utils/ruby_version_check.rb
|
247
245
|
- lib/charyf/utils/storage/provider.rb
|
@@ -1,97 +0,0 @@
|
|
1
|
-
require_relative 'parser'
|
2
|
-
|
3
|
-
module Charyf
|
4
|
-
module Utils
|
5
|
-
module Parser
|
6
|
-
# noinspection RubyLiteralArrayInspection,RubyQuotedStringsInspection
|
7
|
-
# English string normalization
|
8
|
-
class English < Base
|
9
|
-
|
10
|
-
strategy_name :en
|
11
|
-
|
12
|
-
CONTRACTION = ["ain't", "aren't", "can't", "could've", "couldn't",
|
13
|
-
"didn't", "doesn't", "don't", "gonna", "gotta",
|
14
|
-
"hadn't", "hasn't", "haven't", "he'd", "he'll", "he's",
|
15
|
-
"how'd", "how'll", "how's", "I'd", "I'll", "I'm",
|
16
|
-
"I've", "isn't", "it'd", "it'll", "it's", "mightn't",
|
17
|
-
"might've", "mustn't", "must've", "needn't", "oughtn't",
|
18
|
-
"shan't", "she'd", "she'll", "she's", "shouldn't",
|
19
|
-
"should've", "somebody's", "someone'd", "someone'll",
|
20
|
-
"someone's", "that'll", "that's", "that'd", "there'd",
|
21
|
-
"there're", "there's", "they'd", "they'll", "they're",
|
22
|
-
"they've", "wasn't", "we'd", "we'll", "we're", "we've",
|
23
|
-
"weren't", "what'd", "what'll", "what're", "what's",
|
24
|
-
"whats",
|
25
|
-
"what've", "when's", "when'd", "where'd", "where's",
|
26
|
-
"where've", "who'd", "who'd've", "who'll", "who're",
|
27
|
-
"who's", "who've", "why'd", "why're", "why's", "won't",
|
28
|
-
"won't've", "would've", "wouldn't", "wouldn't've",
|
29
|
-
"y'all", "ya'll", "you'd", "you'd've", "you'll",
|
30
|
-
"y'aint", "y'ain't", "you're", "you've"].map(&:downcase).freeze
|
31
|
-
|
32
|
-
EXPANSION = ["is not", "are not", "can not", "could have",
|
33
|
-
"could not", "did not", "does not", "do not",
|
34
|
-
"going to", "got to", "had not", "has not",
|
35
|
-
"have not", "he would", "he will", "he is", "how did",
|
36
|
-
"how will", "how is", "I would", "I will", "I am",
|
37
|
-
"I have", "is not", "it would", "it will", "it is",
|
38
|
-
"might not", "might have", "must not", "must have",
|
39
|
-
"need not", "ought not", "shall not", "she would",
|
40
|
-
"she will", "she is", "should not", "should have",
|
41
|
-
"somebody is", "someone would", "someone will",
|
42
|
-
"someone is", "that will", "that is", "that would",
|
43
|
-
"there would", "there are", "there is", "they would",
|
44
|
-
"they will", "they are", "they have", "was not",
|
45
|
-
"we would", "we will", "we are", "we have",
|
46
|
-
"were not", "what did", "what will", "what are",
|
47
|
-
"what is",
|
48
|
-
"what is", "what have", "when is", "when did",
|
49
|
-
"where did", "where is", "where have", "who would",
|
50
|
-
"who would have", "who will", "who are", "who is",
|
51
|
-
"who have", "why did", "why are", "why is",
|
52
|
-
"will not", "will not have", "would have",
|
53
|
-
"would not", "would not have", "you all", "you all",
|
54
|
-
"you would", "you would have", "you will",
|
55
|
-
"you are not", "you are not", "you are", "you have"].map(&:downcase).freeze
|
56
|
-
|
57
|
-
TEXT_NUMBERS = ["zero", "one", "two", "three", "four", "five", "six",
|
58
|
-
"seven", "eight", "nine", "ten", "eleven", "twelve",
|
59
|
-
"thirteen", "fourteen", "fifteen", "sixteen",
|
60
|
-
"seventeen", "eighteen", "nineteen", "twenty"].map(&:downcase).freeze
|
61
|
-
|
62
|
-
ARTICLES = ["the", "a", "an"].map(&:downcase).freeze
|
63
|
-
|
64
|
-
def self.normalize(text, remove_articles: true)
|
65
|
-
words = text.split
|
66
|
-
|
67
|
-
normalized = ''
|
68
|
-
|
69
|
-
words.each do |word|
|
70
|
-
next if word.empty?
|
71
|
-
next if remove_articles && ARTICLES.include?(word.downcase)
|
72
|
-
|
73
|
-
# Expand common contractions, e.g. "isn't" -> "is not"
|
74
|
-
if CONTRACTION.include?(word.downcase)
|
75
|
-
capitalize = false
|
76
|
-
if word[0] == word[0].upcase
|
77
|
-
capitalize = true
|
78
|
-
end
|
79
|
-
word = EXPANSION[CONTRACTION.index(word.downcase)]
|
80
|
-
|
81
|
-
word.capitalize! if capitalize
|
82
|
-
end
|
83
|
-
|
84
|
-
if TEXT_NUMBERS.include?(word.downcase)
|
85
|
-
word = TEXT_NUMBERS.index(word.downcase)
|
86
|
-
end
|
87
|
-
|
88
|
-
normalized += " " + word
|
89
|
-
end
|
90
|
-
|
91
|
-
normalized.strip
|
92
|
-
end
|
93
|
-
|
94
|
-
end
|
95
|
-
end
|
96
|
-
end
|
97
|
-
end
|
@@ -1,30 +0,0 @@
|
|
1
|
-
require_relative '../../support/string'
|
2
|
-
require_relative '../strategy/base_class'
|
3
|
-
require_relative '../strategy/owner_class'
|
4
|
-
|
5
|
-
module Charyf
|
6
|
-
module Utils
|
7
|
-
module Parser
|
8
|
-
|
9
|
-
extend Charyf::Strategy::OwnerClass
|
10
|
-
|
11
|
-
class Base
|
12
|
-
|
13
|
-
include Charyf::Strategy::BaseClass
|
14
|
-
|
15
|
-
# TODO sig
|
16
|
-
def self.normalize(text, remove_articles: true)
|
17
|
-
raise Charyf::Utils::NotImplemented.new
|
18
|
-
end
|
19
|
-
|
20
|
-
end # End of base
|
21
|
-
|
22
|
-
# TODO sig
|
23
|
-
def self.get(language)
|
24
|
-
# TODO implement
|
25
|
-
Charyf::Utils::Parser::English
|
26
|
-
list[language]
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|