Skip to content

Commit

Permalink
Update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
synesthesiam committed Oct 14, 2021
1 parent df7d9a7 commit 4d1d31d
Show file tree
Hide file tree
Showing 13 changed files with 621 additions and 51 deletions.
Binary file modified docs/.doctrees/environment.pickle
Binary file not shown.
Binary file modified docs/.doctrees/gruut.doctree
Binary file not shown.
Binary file modified docs/.doctrees/index.doctree
Binary file not shown.
79 changes: 78 additions & 1 deletion docs/_sources/index.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,51 @@ Output::
. ‖


Note that "wound" and "read" have different pronunciations in different contexts.
Note that "wound" and "read" have different pronunciations in different (grammatical) contexts.

A subset of :ref:`SSML <ssml_support>` is also supported:

.. code-block:: python
from gruut import sentences
ssml_text = """<?xml version="1.0" encoding="ISO-8859-1"?>
<speak version="1.1" xmlns="http://www.w3.org/2001/10/synthesis"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.w3.org/2001/10/synthesis
http://www.w3.org/TR/speech-synthesis11/synthesis.xsd"
xml:lang="en-US">
<s>Today at 4pm, 2/1/2000.</s>
<s xml:lang="it">Un mese fà, 2/1/2000.</s>
</speak>"""
for sent in sentences(ssml_text, ssml=True):
for word in sent:
if word.phonemes:
print(sent.idx, word.lang, word.text, *word.phonemes)
with the output::

0 en-US Today t ə d ˈeɪ
0 en-US at ˈæ t
0 en-US four f ˈɔ ɹ
0 en-US P p ˈi
0 en-US M ˈɛ m
0 en-US , |
0 en-US February f ˈɛ b j u ˌɛ ɹ i
0 en-US first f ˈɚ s t
0 en-US , |
0 en-US two t ˈu
0 en-US thousand θ ˈaʊ z ə n d
0 en-US . ‖
1 it Un u n
1 it mese ˈm e s e
1 it fà f a
1 it , |
1 it due d j u
1 it gennaio d͡ʒ e n n ˈa j o
1 it duemila d u e ˈm i l a
1 it . ‖

Installation
------------
Expand All @@ -60,6 +104,7 @@ Supported Languages
* German (``de``)
* English (``en``)
* Spanish (``es``)
* Persian/Farsi (``fa``)
* French (``fr``)
* Italian (``it``)
* Dutch (``nl``)
Expand Down Expand Up @@ -177,6 +222,38 @@ which outputs:
See ``gruut --help`` for more options.


.. _ssml_support:

SSML Support
--------------------------

A subset of `the SSML standard <https://www.w3.org/TR/speech-synthesis11/>`_ is supported:

* ``<speak>`` - wrap around SSML text
* ``lang`` - set language for document
* ``<p>`` - paragraph
* ``lang`` - set language for paragraph
* ``<s>`` - sentence (disables automatic sentence breaking)
* ``lang`` - set language for sentence
* ``<w>`` / ``<token>`` - word (disables automatic tokenization)
* ``lang`` - set language for word
* ``role`` - set word role (see [word roles](#word-roles))
* ``<lang lang="...">`` - set language inner text
* ``<voice name="...">`` - set voice of inner text
* ``<say-as interpret-as="">`` - force interpretation of inner text
* ``interpret-as`` one of "spell-out", "date", "number", "time", or "currency"
* ``format`` - way to format text depending on ``interpret-as``
* number - one of "cardinal", "ordinal", "digits", "year"
* date - string with "d" (cardinal day), "o" (ordinal day), "m" (month), or "y" (year)
* ``<break time="">`` - Pause for given amount of time
* time - seconds ("123s") or milliseconds ("123ms")
* ``<sub alias="">`` - substitute ``alias`` for inner text
* ``<phoneme ph="...">`` - supply phonemes for inner text
* ``ph`` - phonemes for each word of inner text, separated by whitespace
* ``alphabet`` - if "ipa", phonemes are intelligently split ("aːˈb" -> "aː", "ˈb")


.. _database:

Database
Expand Down
94 changes: 85 additions & 9 deletions docs/genindex.html
Original file line number Diff line number Diff line change
Expand Up @@ -254,16 +254,22 @@ <h2 id="E">E</h2>
<li><a href="gruut.html#gruut.const.Node.element">(gruut.const.Node attribute)</a>
</li>
</ul></li>
<li><a href="gruut.html#gruut.lang.en_get_ordinal">en_get_ordinal() (in module gruut.lang)</a>
</li>
<li><a href="gruut.html#gruut.lang.en_is_initialism">en_is_initialism() (in module gruut.lang)</a>
</li>
<li><a href="gruut.html#gruut.lang.en_parse_time">en_parse_time() (in module gruut.lang)</a>
</li>
<li><a href="gruut.html#gruut.lang.en_verbalize_time">en_verbalize_time() (in module gruut.lang)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="gruut.html#gruut.g2p.GraphemesToPhonemes.encode_string">encode_string() (gruut.g2p.GraphemesToPhonemes static method)</a>

<ul>
<li><a href="gruut.html#gruut.pos.PartOfSpeechTagger.encode_string">(gruut.pos.PartOfSpeechTagger static method)</a>
</li>
</ul></li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="gruut.html#gruut.const.TextProcessorSettings.end_punctuations">end_punctuations (gruut.const.TextProcessorSettings attribute)</a>

<ul>
Expand Down Expand Up @@ -327,9 +333,17 @@ <h2 id="G">G</h2>
<li><a href="gruut.html#gruut.lang.get_fr_settings">get_fr_settings() (in module gruut.lang)</a>
</li>
<li><a href="gruut.html#gruut.lang.get_it_settings">get_it_settings() (in module gruut.lang)</a>
</li>
<li><a href="gruut.html#gruut.const.BreakNode.get_milliseconds">get_milliseconds() (gruut.const.BreakNode method)</a>
</li>
<li><a href="gruut.html#gruut.lang.get_nl_settings">get_nl_settings() (in module gruut.lang)</a>
</li>
<li><a href="gruut.html#gruut.const.TextProcessorSettings.get_ordinal">get_ordinal (gruut.const.TextProcessorSettings attribute)</a>

<ul>
<li><a href="gruut.html#gruut.TextProcessorSettings.get_ordinal">(gruut.TextProcessorSettings attribute)</a>
</li>
</ul></li>
<li><a href="gruut.html#gruut.const.TextProcessorSettings.get_parts_of_speech">get_parts_of_speech (gruut.const.TextProcessorSettings attribute)</a>

<ul>
Expand Down Expand Up @@ -363,11 +377,11 @@ <h2 id="G">G</h2>
<li><a href="gruut.html#gruut.lang.get_zh_settings">get_zh_settings() (in module gruut.lang)</a>
</li>
<li><a href="gruut.html#gruut.const.GetPartsOfSpeech">GetPartsOfSpeech (class in gruut.const)</a>
</li>
<li><a href="gruut.html#gruut.g2p.GraphemesToPhonemes.grapheme2features">grapheme2features() (gruut.g2p.GraphemesToPhonemes static method)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="gruut.html#gruut.g2p.GraphemesToPhonemes.grapheme2features">grapheme2features() (gruut.g2p.GraphemesToPhonemes static method)</a>
</li>
<li><a href="gruut.html#gruut.g2p.GraphemesToPhonemes">GraphemesToPhonemes (class in gruut.g2p)</a>
</li>
<li><a href="gruut.html#gruut.const.GraphType">GraphType (class in gruut.const)</a>
Expand Down Expand Up @@ -466,6 +480,10 @@ <h2 id="H">H</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="gruut.html#gruut.const.has_digit">has_digit() (in module gruut.const)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="gruut.html#gruut.const.Time.hours">hours (gruut.const.Time attribute)</a>
</li>
</ul></td>
</tr></table>
Expand All @@ -482,6 +500,8 @@ <h2 id="I">I</h2>
<li><a href="gruut.html#gruut.const.IgnoreNode">IgnoreNode (class in gruut.const)</a>
</li>
<li><a href="gruut.html#gruut.const.Node.implicit">implicit (gruut.const.Node attribute)</a>
</li>
<li><a href="gruut.html#gruut.const.WordNode.in_lexicon">in_lexicon (gruut.const.WordNode attribute)</a>
</li>
<li><a href="gruut.html#gruut.const.WordNode.interpret_as">interpret_as (gruut.const.WordNode attribute)</a>
</li>
Expand All @@ -499,10 +519,10 @@ <h2 id="I">I</h2>
</ul></li>
<li><a href="gruut.html#gruut.is_language_supported">is_language_supported() (in module gruut)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="gruut.html#gruut.const.Word.is_major_break">is_major_break (gruut.const.Word attribute)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="gruut.html#gruut.const.TextProcessorSettings.is_maybe_currency">is_maybe_currency() (gruut.const.TextProcessorSettings method)</a>

<ul>
Expand All @@ -519,6 +539,12 @@ <h2 id="I">I</h2>

<ul>
<li><a href="gruut.html#gruut.TextProcessorSettings.is_maybe_number">(gruut.TextProcessorSettings method)</a>
</li>
</ul></li>
<li><a href="gruut.html#gruut.const.TextProcessorSettings.is_maybe_time">is_maybe_time() (gruut.const.TextProcessorSettings method)</a>

<ul>
<li><a href="gruut.html#gruut.TextProcessorSettings.is_maybe_time">(gruut.TextProcessorSettings method)</a>
</li>
</ul></li>
<li><a href="gruut.html#gruut.const.Word.is_minor_break">is_minor_break (gruut.const.Word attribute)</a>
Expand Down Expand Up @@ -575,10 +601,12 @@ <h2 id="L">L</h2>
<li><a href="gruut.html#gruut.TextProcessorSettings.lang">(gruut.TextProcessorSettings attribute)</a>
</li>
</ul></li>
<li><a href="gruut.html#gruut.utils.leaves">leaves() (in module gruut.utils)</a>
<li><a href="gruut.html#gruut.const.Word.leading_ws">leading_ws (gruut.const.Word attribute)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="gruut.html#gruut.utils.leaves">leaves() (in module gruut.utils)</a>
</li>
<li><a href="gruut.html#gruut.const.WordRole.LETTER">LETTER (gruut.const.WordRole attribute)</a>
</li>
<li><a href="gruut.html#gruut.g2p_phonetisaurus.PhonetisaurusGraph.load">load() (gruut.g2p_phonetisaurus.PhonetisaurusGraph static method)</a>
Expand Down Expand Up @@ -643,6 +671,8 @@ <h2 id="M">M</h2>
<li><a href="gruut.html#gruut.TextProcessorSettings.minor_breaks_pattern">(gruut.TextProcessorSettings attribute)</a>
</li>
</ul></li>
<li><a href="gruut.html#gruut.const.Time.minutes">minutes (gruut.const.Time attribute)</a>
</li>
<li>
module

Expand Down Expand Up @@ -738,9 +768,35 @@ <h2 id="P">P</h2>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="gruut.html#gruut.utils.pairwise">pairwise() (in module gruut.utils)</a>
</li>
<li><a href="gruut.html#gruut.const.Sentence.par_idx">par_idx (gruut.const.Sentence attribute)</a>

<ul>
<li><a href="gruut.html#gruut.const.Word.par_idx">(gruut.const.Word attribute)</a>
</li>
</ul></li>
<li><a href="gruut.html#gruut.const.ParagraphNode">ParagraphNode (class in gruut.const)</a>
</li>
<li><a href="gruut.html#gruut.const.TextProcessorSettings.parse_time">parse_time (gruut.const.TextProcessorSettings attribute)</a>

<ul>
<li><a href="gruut.html#gruut.TextProcessorSettings.parse_time">(gruut.TextProcessorSettings attribute)</a>
</li>
</ul></li>
<li><a href="gruut.html#gruut.pos.PartOfSpeechTagger">PartOfSpeechTagger (class in gruut.pos)</a>
</li>
<li><a href="gruut.html#gruut.const.Sentence.pause_after_ms">pause_after_ms (gruut.const.Sentence attribute)</a>

<ul>
<li><a href="gruut.html#gruut.const.Word.pause_after_ms">(gruut.const.Word attribute)</a>
</li>
</ul></li>
<li><a href="gruut.html#gruut.const.Sentence.pause_before_ms">pause_before_ms (gruut.const.Sentence attribute)</a>

<ul>
<li><a href="gruut.html#gruut.const.Word.pause_before_ms">(gruut.const.Word attribute)</a>
</li>
</ul></li>
<li><a href="gruut.html#gruut.const.Time.period">period (gruut.const.Time attribute)</a>
</li>
<li><a href="gruut.html#gruut.const.Word.phonemes">phonemes (gruut.const.Word attribute)</a>

Expand All @@ -750,6 +806,8 @@ <h2 id="P">P</h2>
</ul></li>
<li><a href="gruut.html#gruut.g2p_phonetisaurus.PhonetisaurusGraph">PhonetisaurusGraph (class in gruut.g2p_phonetisaurus)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="gruut.html#gruut.utils.pipeline_split">pipeline_split() (in module gruut.utils)</a>
</li>
<li><a href="gruut.html#gruut.utils.pipeline_transform">pipeline_transform() (in module gruut.utils)</a>
Expand All @@ -766,8 +824,6 @@ <h2 id="P">P</h2>
<li><a href="gruut.html#gruut.TextProcessor.post_process_graph">(gruut.TextProcessor method)</a>
</li>
</ul></li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="gruut.html#gruut.const.TextProcessorSettings.post_process_sentence">post_process_sentence (gruut.const.TextProcessorSettings attribute)</a>

<ul>
Expand Down Expand Up @@ -801,6 +857,8 @@ <h2 id="R">R</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="gruut.html#gruut.const.GraphType.remove_edges_from">remove_edges_from() (gruut.const.GraphType method)</a>
</li>
<li><a href="gruut.html#gruut.utils.remove_non_word_chars">remove_non_word_chars() (in module gruut.utils)</a>
</li>
<li><a href="gruut.html#gruut.const.TextProcessorSettings.replacements">replacements (gruut.const.TextProcessorSettings attribute)</a>

Expand Down Expand Up @@ -887,6 +945,8 @@ <h2 id="T">T</h2>
</li>
</ul></li>
<li><a href="gruut.html#gruut.utils.text_and_elements">text_and_elements() (in module gruut.utils)</a>
</li>
<li><a href="gruut.html#gruut.const.Sentence.text_spoken">text_spoken (gruut.const.Sentence attribute)</a>
</li>
<li><a href="gruut.html#gruut.const.BreakWordNode.text_with_ws">text_with_ws (gruut.const.BreakWordNode attribute)</a>

Expand Down Expand Up @@ -914,7 +974,15 @@ <h2 id="T">T</h2>
<li><a href="gruut.html#gruut.const.TextProcessorSettings">(class in gruut.const)</a>
</li>
</ul></li>
<li><a href="gruut.html#gruut.const.Time">Time (class in gruut.const)</a>
</li>
<li><a href="gruut.html#gruut.const.BreakNode.time">time (gruut.const.BreakNode attribute)</a>
</li>
<li><a href="gruut.html#gruut.const.InterpretAs.TIME">TIME (gruut.const.InterpretAs attribute)</a>
</li>
<li><a href="gruut.html#gruut.const.WordNode.time">time (gruut.const.WordNode attribute)</a>
</li>
<li><a href="gruut.html#gruut.const.Word.trailing_ws">trailing_ws (gruut.const.Word attribute)</a>
</li>
<li><a href="gruut.html#gruut.g2p.train">train() (in module gruut.g2p)</a>
</li>
Expand All @@ -925,6 +993,14 @@ <h2 id="T">T</h2>

<h2 id="V">V</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="gruut.html#gruut.const.TextProcessorSettings.verbalize_time">verbalize_time (gruut.const.TextProcessorSettings attribute)</a>

<ul>
<li><a href="gruut.html#gruut.TextProcessorSettings.verbalize_time">(gruut.TextProcessorSettings attribute)</a>
</li>
</ul></li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="gruut.html#gruut.const.Node.voice">voice (gruut.const.Node attribute)</a>

Expand Down
Loading

0 comments on commit 4d1d31d

Please sign in to comment.