Holen Sie sich alle kyrillischen Zeichen mit jeder Art von Akzent/Diakritik [geschlossen]Python

Python-Programme
Anonymous
 Holen Sie sich alle kyrillischen Zeichen mit jeder Art von Akzent/Diakritik [geschlossen]

Post by Anonymous »

Ich muss kyrillisch (und nur kyrillisch) mit Diakritik (alle Arten) identifizieren. These include:
  • Any Unicode code points that represents a Cyrillic letter immediately followed by any of the following diacritic marks:

    ̀‎0300 COMBINING GRAVE ACCENT
  • 0301 COMBINING ACUTE ACCENT
  • ‎0303 COMBINING Tilde < /li>
    0304 Kombinieren Sie Makron < /li>
    0306 Kombinieren Sie Breve < /li>
    0307 Kombinieren Sie DOT über < /li>
    0308 Kombinieren Sie die Diarese < /li>
    030a -concining -Kombinierung von Klingeln. Akzent
  • 030c kombiniert Caron
  • 030f Kombination Doppelgravenakzent />‎0331 COMBINING MACRON BELOW
  • ‎033E COMBINING VERTICAL TILDE
[*]Any Unicode code point that represents a Cyrillic letter that can be decomposed into a base letter and a combining mark

The code I have works Ganz gut, außer dass es keine kombinierten Zeichen erfasst (erste Gruppe in der Testzeichenfolge, ist ́́ aus irgendeinem Grund keinen Akzent angezeigt). < /p>

Code: Select all

import unicodedata

# Define Cyrillic Unicode ranges
cyrillic_ranges = [
(0x0400, 0x04FF),  # Cyrillic
(0x0500, 0x052F),  # Cyrillic Supplement
(0x2DE0, 0x2DFF),  # Cyrillic Extended-A
(0xA640, 0xA69F),  # Cyrillic Extended-B
(0x1C80, 0x1C8F),  # Cyrillic Extended-C
(0x1E030, 0x1E08F),  # Cyrillic Extended-D
(0x1D2B, 0x1D2B),  # Phonetic Extension (ᴫ)
(0x1D78, 0x1D78)   # Phonetic Extension (ᵸ)
]

diacritics = {
0x0300, 0x0301, 0x0303, 0x0304, 0x0306, 0x0307, 0x0308, 0x030A,
0x030B, 0x030C, 0x030F, 0x0311, 0x0323, 0x0328, 0x0331, 0x033E
}

def is_cyrillic_with_diacritic(char):
char_code = ord(char)
if any(start

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post