ssmd 0.5.0 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 03caaaca94965b74c05fc30c4eeb711f78b533b0
4
- data.tar.gz: 4f046adf9b9f249dca0a0314c1145a6f3511ef87
3
+ metadata.gz: e1072f2246db4e38fe72f48c909bd41a0ef3de15
4
+ data.tar.gz: 6d13a771d0699df8bd167d81b91d7c475788a1f7
5
5
  SHA512:
6
- metadata.gz: 2066578aac73b3ac021aa060eeb8d06befdf9fcbcdb70c8782b275d86cb95d1632fcca4bb727bd54def7ae009e8e8ed3bf1930709f78d1291a441b13602b1f5a
7
- data.tar.gz: 7ab57f41be445fb91b5c1c412b4824710bb81a5bb4fed30be8e251841438ea0e9e5ac41982e5fd0702991e60050404943a9d2307dc9d82b7e73f57fff6234adf
6
+ metadata.gz: '079ba3acf4807aef4a98133a3ab572efa039e1e078ddc60a3f92e26011a2fb15706d06db416ba87b19417b5a483d87bb0b0a5277ea62e83d6ec684e820bebf0c'
7
+ data.tar.gz: 065fdf57abff4dabf7b6b58bd010b677974c6d070fea7ad5588dd8d62521dba498e4d5d09c9a4d401698049d9e45bc91dcc411c1b8dd3644075affd4f33d61f1
data/README.md CHANGED
@@ -40,16 +40,19 @@ puts ssml
40
40
 
41
41
  **Note:**
42
42
 
43
- This version is still under development. So far only the following conversions
44
- described in the specification are implemented:
45
-
46
- * Text
47
- * Emphasis
48
- * Mark
49
- * Language
50
- * Phoneme
51
- * Prosody
52
- * Paragraph
43
+ This version is still under development. See below which essential SSML constructs are implemented so far:
44
+
45
+ * [x] Text
46
+ * [x] Emphasis
47
+ * [x] Break
48
+ * [x] Language
49
+ * [x] Mark
50
+ * [x] Paragraph
51
+ * [x] Phoneme
52
+ * [x] Prosody
53
+ * [ ] Say-as
54
+ * [x] Substitution
55
+ * [ ] Extensions
53
56
 
54
57
  ## Development
55
58
 
@@ -69,14 +69,14 @@ Hello ...100 world (100 millisecond break (max 10000ms))
69
69
 
70
70
  SSML:
71
71
  ```html
72
- Hello <break strength="x-strong"/> world
73
- Hello - <break strength="none"/> world
74
- Hello <break strength="medium"/> world
75
- Hello <break strength="strong"/> world
76
- Hello <break strength="x-strong"/> world
77
- Hello <break time="5s"/> world
78
- Hello <break time="100ms"/> world
79
- Hello <break time="100ms"/> world
72
+ Hello <break strength="x-strong"/> world (default: x-strong break like after a paragraph)
73
+ Hello - <break strength="none"/> world (skip break when there would otherwise be one like after this dash)
74
+ Hello <break strength="medium"/> world (medium break like after a comma)
75
+ Hello <break strength="strong"/> world (strong break like after a sentence)
76
+ Hello <break strength="x-strong"/> world (extra string break like after a paragraph)
77
+ Hello <break time="5s"/> world (5 second break (max 10s))
78
+ Hello <break time="100ms"/> world (100 millisecond break (max 10000ms))
79
+ Hello <break time="100ms"/> world (100 millisecond break (max 10000ms))
80
80
  ```
81
81
 
82
82
  ***
@@ -33,7 +33,7 @@ module SSMD
33
33
 
34
34
  [
35
35
  p::EmphasisProcessor, p::AnnotationProcessor, p::MarkProcessor,
36
- p::ProsodyProcessor, p::ParagraphProcessor
36
+ p::ProsodyProcessor, p::ParagraphProcessor, p::BreakProcessor
37
37
  ]
38
38
  end
39
39
  end
@@ -4,6 +4,7 @@ end
4
4
 
5
5
  require 'ssmd/processors/processor'
6
6
  require 'ssmd/processors/annotation_processor'
7
+ require 'ssmd/processors/break_processor'
7
8
  require 'ssmd/processors/emphasis_processor'
8
9
  require 'ssmd/processors/mark_processor'
9
10
  require 'ssmd/processors/prosody_processor'
@@ -0,0 +1,35 @@
1
+ require_relative 'processor'
2
+
3
+ module SSMD::Processors
4
+ class BreakProcessor < Processor
5
+ def result
6
+ name, value = attribute
7
+
8
+ "<break #{name}=\"#{value}\"/>"
9
+ end
10
+
11
+ def regex
12
+ /(?<=\s)\.\.\.(?:(?<comma>c)|(?<sentence>s)|(?<paragraph>p)|(?<s>\d+s)|(?<ms>\d+ms)|(?<num>\d+))?(?=\s)/
13
+ end
14
+
15
+ def attribute
16
+ if ms = (match[:num] || match[:ms])
17
+ if ms == "0"
18
+ ["strength", "none"]
19
+ else
20
+ ["time", "#{ms.to_i}ms"]
21
+ end
22
+ elsif s = match[:s]
23
+ ["time", "#{s.to_i}s"]
24
+ elsif match[:paragraph]
25
+ ["strength", "x-strong"]
26
+ elsif match[:sentence]
27
+ ["strength", "strong"]
28
+ elsif match[:comma]
29
+ ["strength", "medium"]
30
+ else
31
+ ["strength", "x-strong"]
32
+ end
33
+ end
34
+ end
35
+ end
@@ -1,3 +1,3 @@
1
1
  module SSMD
2
- VERSION = "0.5.0"
2
+ VERSION = "0.6.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ssmd
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Markus Kahl
@@ -115,6 +115,7 @@ files:
115
115
  - lib/ssmd/converter.rb
116
116
  - lib/ssmd/processors.rb
117
117
  - lib/ssmd/processors/annotation_processor.rb
118
+ - lib/ssmd/processors/break_processor.rb
118
119
  - lib/ssmd/processors/emphasis_processor.rb
119
120
  - lib/ssmd/processors/mark_processor.rb
120
121
  - lib/ssmd/processors/paragraph_processor.rb