Home | Trees | Indices | Help |
|
---|
|
1 #!/usr/bin/env python 2 # -*- coding: utf-8 -*- 3 # 4 # Copyright 2007 Zuza Software Foundation 5 # 6 # This file is part of translate. 7 # 8 # translate is free software; you can redistribute it and/or modify 9 # it under the terms of the GNU General Public License as published by 10 # the Free Software Foundation; either version 2 of the License, or 11 # (at your option) any later version. 12 # 13 # translate is distributed in the hope that it will be useful, 14 # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 # GNU General Public License for more details. 17 # 18 # You should have received a copy of the GNU General Public License 19 # along with translate; if not, write to the Free Software 20 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 22 """This module represents Afrikaans language. 23 24 For more information, see U{http://en.wikipedia.org/wiki/Afrikaans_language} 25 """ 26 27 import re 28 29 from translate.lang import common 30 31 articlere = re.compile(r"'n\b") 32 3335 """This class represents Afrikaans.""" 36 37 punctuation = u"".join([common.Common.commonpunc, common.Common.quotes, 38 common.Common.miscpunc]) 39 sentenceend = u".!?…" 40 sentencere = re.compile(r"""(?s) #make . also match newlines 41 .*? #anything, but match non-greedy 42 [%s] #the puntuation for sentence ending 43 \s+ #the spacing after the puntuation 44 (?='n\s[A-Z]|[^'a-z\d]|'[^n]) 45 #lookahead that next part starts with caps or 'n followed by caps 46 """ % sentenceend, re.VERBOSE) 4760 61 cyr2lat = { 62 u"А": "A", u"а": "a", 63 u"Б": "B", u"б": "b", 64 u"В": "W", u"в": "w", # Different if at the end of a syllable see rule 2. 65 u"Г": "G", u"г": "g", # see rule 3 and 4 66 u"Д": "D", u"д": "d", 67 u"ДЖ": "Dj", u"дж": "dj", 68 u"Е": "Je", u"е": "je", # Sometimes e need to check when/why see rule 5. 69 u"Ё": "Jo", u"ё": "jo", # see rule 6 70 u"ЕЙ": "Ei", u"ей": "ei", 71 u"Ж": "Zj", u"ж": "zj", 72 u"З": "Z", u"з": "z", 73 u"И": "I", u"и": "i", 74 u"Й": "J", u"й": "j", # see rule 9 and 10 75 u"К": "K", u"к": "k", # see note 11 76 u"Л": "L", u"л": "l", 77 u"М": "M", u"м": "m", 78 u"Н": "N", u"н": "n", 79 u"О": "O", u"о": "o", 80 u"П": "P", u"п": "p", 81 u"Р": "R", u"р": "r", 82 u"С": "S", u"с": "s", # see note 12 83 u"Т": "T", u"т": "t", 84 u"У": "Oe", u"у": "oe", 85 u"Ф": "F", u"ф": "f", 86 u"Х": "Ch", u"х": "ch", # see rule 12 87 u"Ц": "Ts", u"ц": "ts", 88 u"Ч": "Tj", u"ч": "tj", 89 u"Ш": "Sj", u"ш": "sj", 90 u"Щ": "Sjtsj", u"щ": "sjtsj", 91 u"Ы": "I", u"ы": "i", # see note 13 92 u"Ъ": "", u"ъ": "", # See note 14 93 u"Ь": "", u"ь": "", # this letter is not in the AWS we assume it is left out as in the previous letter 94 u"Э": "E", u"э": "e", 95 u"Ю": "Joe", u"ю": "joe", 96 u"Я": "Ja", u"я": "ja", 97 } 98 """Mapping of Cyrillic to Latin letters for transliteration in Afrikaans""" 99 100 cyr_vowels = u"аеёиоуыэюя" 101 102 10949 """Modify this for the indefinite article ('n).""" 50 match = articlere.search(text, 0, 20) 51 if match: 52 #construct a list of non-apostrophe punctuation: 53 nonapos = u"".join(cls.punctuation.split(u"'")) 54 stripped = text.lstrip().lstrip(nonapos) 55 match = articlere.match(stripped) 56 if match: 57 return common.Common.capsstart(stripped[match.end():]) 58 return common.Common.capsstart(text)59 capsstart = classmethod(capsstart)
Home | Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Wed Jan 19 17:50:58 2011 | http://epydoc.sourceforge.net |