Attachment 'pronounc.py'
Download 1 #!/usr/bin/python
2 # -*- coding: utf-8 -*-
3
4 '''Произносимые слова
5 Вариант со слогами
6 '''
7
8 import random
9
10 # Alp[0] -- согласные, Alp[1] -- гласные
11 # Попытаемяся учесть частотность
12 Alp=(u"бвввгдджзйкккллллмнпррррссссстттфхцчшщ",u"аааэыооооууяяеееёёю")
13 Syl=( # Виды слогов
14 (1,0),
15 (0,1),
16 (1,0,1),
17 (0,1,0),
18 )
19
20 Word=u""
21 for i in range(random.randint(2,5)): # количество слогов
22 # выберем тип слога
23 Skel=random.choice(Syl)
24 # сформируем слог
25 Part=u"".join([random.choice(Alp[i]) for i in Skel])
26 Word+=Part
27 print Word
Attached Files
To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.- [get | view] (2011-09-26 08:35:38, 0.4 KB) [[attachment:pronoun.py]]
- [get | view] (2011-09-26 08:35:38, 0.7 KB) [[attachment:pronounc.py]]
- [get | view] (2011-09-26 08:35:38, 0.3 KB) [[attachment:pronounn.py]]
- [get | view] (2011-09-26 08:35:38, 0.4 KB) [[attachment:randd.py]]
- [get | view] (2011-09-26 08:35:38, 0.7 KB) [[attachment:randdf.py]]
- [get | view] (2011-09-26 08:35:38, 0.3 KB) [[attachment:strshuf.py]]
- [get | view] (2011-09-26 08:35:38, 0.3 KB) [[attachment:strshufm.py]]
You are not allowed to attach a file to this page.