Giter Site home page Giter Site logo

yandex_speech's Introduction

yandex_speech

https://landscape.io/github/art1415926535/yandex_speech/master/landscape.svg?style=flat

Installation

Use Pip, Luke

$ pip install yandex_speech

Usage

Text to speech

Speech to text (not ready)

Natural language understanding


Text to speech

Generation of speech using Yandex SpeechKit. SpeechKit Cloud allows you to voice any text in Russian, English, Turkish, or Ukrainian. You can choose the voice (male or female), tempo and intonation (e.g., joy).

>>> from yandex_speech import TTS
>>> tts = TTS("jane", "mp3", "60589d42-0e42-b742-8942-thekeyisalie")
>>> tts.generate("Привет мир")
>>> tss.save()
speech.mp3

TTS(speaker, audio_format, key, lang="ru‑RU", emotion="neutral", speed=1)

  • speaker - Speaker. Female: "jane", "oksana", "alyss", "omazh". Male: "zahar", "ermil";
  • audio_format - Audio file format: "mp3", "wav", "opus";
  • key - API‑key for Yandex speech kit.
  • lang (optional) - Language: "ru‑RU" (by default), "en-US", "tr-TR", "uk-UK";
  • emotion (optional) - The color of the voice: "neutral" (by default), "evil", "good";
  • speed (optional) - Speech tempo: a value between 0.1 (slowest) to 3.0 (fastest).

tts.generate(text)

  • text - Text to speech: "з+амок" (before the stressed vowel can be put "+"; the restriction on line length: 2000 bytes);

tts.save(path="speech")

  • path (optional) - A path to save file: "test", "dirname/test.mp3", ...;

Returns the path.

References

Overview tts technology

The format of request and response


Natural language understanding

Natural language understanding is a technology that allows you to find certain objects in arbitrary text and mark them.

>>> from yandex_speech import NLU
>>> nlu = NLU("60589d42-0e42-b742-8942-thekeyisalie")
>>> nlu.parse("31 апреля родился Хлусов Геннадий Викторович", ("Date", "Fio"))
{'Date': [{'Tokens': {'Begin': 0, 'End': 2}, 'Month': 4, 'Day': 31}], 'Fio': [{'Patronymic': 'викторович', 'Type': 'fioname', 'Tokens': {'Begin': 3, 'End': 6}, 'FirstName': 'генадий', 'LastName': 'хлусов'}]}

NLU(key)

NLU.parse(text, layers=None)

  • text - Text to parse.
  • layers (optional) - Special fields. Only one string or iterable object (e.g "Data", ("Data", "Fio")). Only these fields will be returned.

Returns the parsed text into a json object.

References

Overview nlu technology

The format of request and response

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.