]> git.basschouten.com Git - openhab-addons.git/blob
c1b5d7a7563da4772aa263c5c05c3a734850028c
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2023 Contributors to the openHAB project
3  *
4  * See the NOTICE file(s) distributed with this work for additional
5  * information.
6  *
7  * This program and the accompanying materials are made available under the
8  * terms of the Eclipse Public License 2.0 which is available at
9  * http://www.eclipse.org/legal/epl-2.0
10  *
11  * SPDX-License-Identifier: EPL-2.0
12  */
13 package org.openhab.voice.googletts.internal.dto;
14
15 /**
16  * Contains text input to be synthesized. Either text or ssml must be supplied. Supplying both or neither returns
17  * google.rpc.Code.INVALID_ARGUMENT. The input size is limited to 5000 characters.
18  *
19  * @author Wouter Born - Initial contribution
20  */
21 public class SynthesisInput {
22
23     /**
24      * The SSML document to be synthesized. The SSML document must be valid and well-formed. Otherwise the RPC will fail
25      * and return google.rpc.Code.INVALID_ARGUMENT.
26      */
27     private String ssml;
28
29     /**
30      * The raw text to be synthesized.
31      */
32     private String text;
33
34     public SynthesisInput() {
35     }
36
37     public SynthesisInput(String text) {
38         if (text.startsWith("<speak>")) {
39             ssml = text;
40         } else {
41             this.text = text;
42         }
43     }
44
45     public String getSsml() {
46         return ssml;
47     }
48
49     public String getText() {
50         return text;
51     }
52
53     public void setSsml(String ssml) {
54         this.ssml = ssml;
55     }
56
57     public void setText(String text) {
58         this.text = text;
59     }
60 }