Beispiel #1
0
def xml_utf8_chunk(element, dom):
    if element.xml_children:
        element.pns_sat_articulated = []
        pns_sat.articulate_chunk(
            ' '.join(xml_utf8.xml_cdatas(element)),
            element.pns_sat_articulated.append, element.pns_sat_language
            or dom.pns_sat_language, element.PNS_SAT_CHUNK)
    elif element.xml_first:
        element.pns_sat_articulated = []
        pns_sat.articulate_chunk(
            element.xml_first, element.pns_sat_articulated.append,
            element.pns_sat_language or dom.pns_sat_language,
            element.PNS_SAT_CHUNK)
def xml_utf8_chunk (element, dom):
        if element.xml_children:
                element.pns_sat_articulated = []
                pns_sat.articulate_chunk (
                        ' '.join (xml_utf8.xml_cdatas (element)),
                        element.pns_sat_articulated.append,
                        element.pns_sat_language or dom.pns_sat_language,
                        element.PNS_SAT_CHUNK
                        )
        elif element.xml_first:
                element.pns_sat_articulated = []
                pns_sat.articulate_chunk (
                        element.xml_first, 
                        element.pns_sat_articulated.append,
                        element.pns_sat_language or dom.pns_sat_language,
                        element.PNS_SAT_CHUNK
                        )
articulated = []
text = (
        "Ce qui se conçoit bien s'énonce clairement\n"
        "Et les mots pour le dire arrivent aisément"
        )
name = pns_sat.articulate_re (
        text, articulated.append, pns_sat.language ('fr')
        )
log_articulated (articulated)

articulated = []
text = (
        'This library is free software; you can redistribute it and/or '
        'modify it under the terms of version 2 of the GNU General Public '
        'License as published by the Free Software Foundation.'
        )
pns_sat.articulate_chunk (
        text, articulated.append, pns_sat.language ('en'), 72
        )
log_articulated (articulated)

text = (
        "Oh je voudrais tant que tu te souvienne "
        "Cette chanson était la tienne "
        "C'était ta préférée, je crois "
        "Qu'elle est de Prévert et Cosma"
        )
articulated_languages = pns_sat.articulate_languages (text, ('fr', 'en'))
loginfo.log ('%r' % (articulated_languages,))