jsspeech2019 0.1.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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 4409169c06276c3f28ab7b7d45d51d59c847474faf781e0a44e7e779143ccc36
4
+ data.tar.gz: c5ad4efe0939a0f655df4e89f0bbc8b85b27b65d72b1a93c1298bf436d526506
5
+ SHA512:
6
+ metadata.gz: 351dbf57ed56433d41ef63155340c182e6439ad7854bea2dd0c1f4d66483fa6a3002ec2e82717806a5c16fd335008321b4e1efb2d9be7901ff8f70ad1e225262
7
+ data.tar.gz: 94290d4f0113037bbce5fc33838822f455720c3737b41ee3aebdd0bd4c3f916d9c27439189a13ed45e53a725df71722b0f03867dc80696d263fe2e4cea9473c9
@@ -0,0 +1,2 @@
1
+ �7�q��G�b�o�2�0���u���.�1�l9�����1V�ȡ��YGdF�����LHԴ��p9d?B�JE%��>���
2
+ �nw�"�NQ$��U*��`qSC�^�?�c������_l����[���8�J!̓B���S�jՎ"���]� Эbv��fճ�}�in�=�޻�y�������S�.�&2ktI,6�qߵ߳�zi���ݙ�5�c�H{��+A�o>��H��
@@ -0,0 +1 @@
1
+ m�8[J4�*���uM�#]�L�X��6�a<�m���>�_��o�-"T�^�����8��C�^Oa�"�#i�Aܳ�� A�{pG��q�H��v�X�.�@���ǿܻ��S���l=�"@��ɽҞ����ߔ�NI��������s�,0i"Qҹq�S�[�$���g��(�~L�9�2��FM l<�/m86���sAs��L3�~^���u����"�n͋,����3=�=#y�g���m�m���ϋ��"��.��r�1D���V�n��<���N/^�:����/��ÆQY�d~�0n+&U6�kb&�<���qAe֧�"��B�]U����2�l�V�.�;��^��}������TW� ���x��9����RU�n[��(���
@@ -0,0 +1,102 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # file: jsspeech2019.rb
4
+
5
+ require 'rexle'
6
+ require 'rexle-builder'
7
+
8
+
9
+
10
+ class JsSpeechRecognition
11
+
12
+
13
+ def initialize(lang: 'en-GB')
14
+ @lang = lang
15
+ end
16
+
17
+ def to_html()
18
+
19
+ <<HTML
20
+ <button id="start-button">Start Listening</button>
21
+ <p><strong>You said:</strong> <em id="demo-echo">nothing yet</em>.</p>
22
+ HTML
23
+ end
24
+
25
+ def to_js()
26
+
27
+ <<JS
28
+ function startListening() {
29
+ var recognition = new (webkitSpeechRecognition || SpeechRecognition)();
30
+ recognition.lang = '#{@lang}';
31
+ recognition.interimResults = false;
32
+ recognition.maxAlternatives = 1;
33
+ recognition.start();
34
+
35
+ [
36
+ 'onaudiostart',
37
+ 'onaudioend',
38
+ 'onend',
39
+ 'onerror',
40
+ 'onnomatch',
41
+ 'onresult',
42
+ 'onsoundstart',
43
+ 'onsoundend',
44
+ 'onspeechend',
45
+ 'onstart'
46
+ ].forEach(function(eventName) {
47
+ recognition[eventName] = function(e) {
48
+ console.log(eventName, e);
49
+ };
50
+ });
51
+
52
+ document.querySelector('#start-button').innerHTML = 'Listening...';
53
+
54
+ recognition.onend = function() {
55
+ document.querySelector('#start-button').innerHTML = 'Start Listening';
56
+ };
57
+ recognition.onresult = function() {
58
+ document.querySelector('#demo-echo').textContent = event.results[0][0].transcript;
59
+ };
60
+ };
61
+
62
+ (function() {
63
+ document.querySelector('#start-button').addEventListener('click', startListening);
64
+ })();
65
+ JS
66
+
67
+ end
68
+
69
+ def to_css()
70
+ ''
71
+ end
72
+
73
+ def to_webpage()
74
+
75
+ a = RexleBuilder.build do |xml|
76
+ xml.html do
77
+ xml.head do
78
+ xml.title 'Speech Recognition'
79
+ xml.meta name: "viewport", content: \
80
+ "width=device-width, initial-scale=1"
81
+ xml.style "\nbody {font-family: Arial;}\n\n" + to_css()
82
+ end
83
+ xml.body
84
+ end
85
+ end
86
+
87
+ doc = Rexle.new(a)
88
+ e = Rexle.new("<html>%s</html>" % to_html()).root
89
+
90
+ e.children.each {|child| doc.root.element('body').add child }
91
+
92
+ doc.root.element('body').add \
93
+ Rexle::Element.new('script').add_text "\n" +
94
+ to_js().gsub(/^ +\/\/[^\n]+\n/,'')
95
+
96
+ "<!DOCTYPE html>\n" + doc.xml(pretty: true, declaration: false)\
97
+ .gsub(/<\/div>/,'\0' + "\n").gsub(/\n *<!--[^>]+>/,'')
98
+
99
+ end
100
+
101
+ end
102
+
metadata ADDED
@@ -0,0 +1,90 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: jsspeech2019
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - James Robertson
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain:
11
+ - |
12
+ -----BEGIN CERTIFICATE-----
13
+ MIIEXjCCAsagAwIBAgIBATANBgkqhkiG9w0BAQsFADAsMSowKAYDVQQDDCFnZW1t
14
+ YXN0ZXIvREM9amFtZXNyb2JlcnRzb24vREM9ZXUwHhcNMTkxMDIxMTQzMTAxWhcN
15
+ MjAxMDIwMTQzMTAxWjAsMSowKAYDVQQDDCFnZW1tYXN0ZXIvREM9amFtZXNyb2Jl
16
+ cnRzb24vREM9ZXUwggGiMA0GCSqGSIb3DQEBAQUAA4IBjwAwggGKAoIBgQCxNVz+
17
+ h68Bbr4vzzf4UlnEYGWYBAV98SoDs7tRgARpbpodFywJ862M2b5lnJdHOv+2I9AH
18
+ u01YBKRB3wPtMVniOZ55c+jxfy++OqQEYe+qC955NtytxcpsC6I2rFMY3Bo0Mk6k
19
+ +Oz4uPrN77AKiOUTyY9oYgtFGN+daImJQg3OELFCm31zsBvmLTDREuWtOlGah+UP
20
+ HHelWwURPEFZt9mNaqdRK4dg/Gew1Et7TlpTBysKOXdDOJrDcnIeTsPKj2eYzqeL
21
+ SW13ZfFZwI3hrc+Xb/fpFDGYPaW/dK7T/mpSwT7qllDy5Rto7VpjCIlLwTF80/BM
22
+ NSlS4mAKWXcQKQHQ70JoWEQbBlD75Z4hTiYJv9mi32zHlM8zXJTbvhkbpQ8f9rVM
23
+ Fg6hq6sSomMEnoE84aOFxH2CSMUh5efYLU7gHPOc1Ee/UC4Wbv9egTxHyCG6tP0G
24
+ oACok3VK2LMc/SMxzU3lgbzrJskiKAPK7ydKGU5dBluZ6LKGRiNc0bPv4SkCAwEA
25
+ AaOBijCBhzAJBgNVHRMEAjAAMAsGA1UdDwQEAwIEsDAdBgNVHQ4EFgQUxq4QxvJU
26
+ owQ9ln9nOkQWIGJHNsEwJgYDVR0RBB8wHYEbZ2VtbWFzdGVyQGphbWVzcm9iZXJ0
27
+ c29uLmV1MCYGA1UdEgQfMB2BG2dlbW1hc3RlckBqYW1lc3JvYmVydHNvbi5ldTAN
28
+ BgkqhkiG9w0BAQsFAAOCAYEAXUhT1sUBApYWmy1whpF73XsmTblB3fiHF5rvHmYG
29
+ ywEhlbTSJcXYwwuNERJyjt6fCLNGVDyHtPRqic/x0qdGUvtRtpQtHYLm9Vum3wQv
30
+ szVGU7nO/almtinl/M5snNIyhDJ2mZ/FG33pBWbSK4yP+tXn4ttV3+gcMjqOIxGr
31
+ kKzzqEJy35JsrsADjMP4dCyS54xJqrFjYuhwcJrD8e+6tjw/rwM0ecFUh+/c8NGZ
32
+ Bm3J+QynwmgnZFColehM4b4BmHEOUpp14sd1WXHl1RZ2FyqYQvuZwIaPLL7600Xp
33
+ +RxZMkX70+GyZZPZubjXNbTCWckB6qnAWAPaPKfLjnFpJOO4wENI3KP5R2f7pYNz
34
+ vYmP0UUsf9hLOPDUcfBNtQopxrsWFqaJVC1eCtrATcHa+Ya+ePU7ouu5fictK97i
35
+ laahUJNRnxavT/V6rgsU797sRsKsp0KNwZXmkrIrgD4ZeDiPbrjR21X9JEvTQ3Kj
36
+ c2iYtQpYWIeRX/gk2gnE2iM/
37
+ -----END CERTIFICATE-----
38
+ date: 2019-10-21 00:00:00.000000000 Z
39
+ dependencies:
40
+ - !ruby/object:Gem::Dependency
41
+ name: rexle
42
+ requirement: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - "~>"
45
+ - !ruby/object:Gem::Version
46
+ version: '1.5'
47
+ - - ">="
48
+ - !ruby/object:Gem::Version
49
+ version: 1.5.3
50
+ type: :runtime
51
+ prerelease: false
52
+ version_requirements: !ruby/object:Gem::Requirement
53
+ requirements:
54
+ - - "~>"
55
+ - !ruby/object:Gem::Version
56
+ version: '1.5'
57
+ - - ">="
58
+ - !ruby/object:Gem::Version
59
+ version: 1.5.3
60
+ description:
61
+ email: james@jamesrobertson.eu
62
+ executables: []
63
+ extensions: []
64
+ extra_rdoc_files: []
65
+ files:
66
+ - lib/jsspeech2019.rb
67
+ homepage: https://github.com/jrobertson/jsspeech2019
68
+ licenses:
69
+ - MIT
70
+ metadata: {}
71
+ post_install_message:
72
+ rdoc_options: []
73
+ require_paths:
74
+ - lib
75
+ required_ruby_version: !ruby/object:Gem::Requirement
76
+ requirements:
77
+ - - ">="
78
+ - !ruby/object:Gem::Version
79
+ version: '0'
80
+ required_rubygems_version: !ruby/object:Gem::Requirement
81
+ requirements:
82
+ - - ">="
83
+ - !ruby/object:Gem::Version
84
+ version: '0'
85
+ requirements: []
86
+ rubygems_version: 3.0.3
87
+ signing_key:
88
+ specification_version: 4
89
+ summary: Builds a web page featuring speech recognition.
90
+ test_files: []
@@ -0,0 +1 @@
1
+ "�P��d���B4�N��-P�g��rvK