Index: gc_core/js/text.js ================================================================== --- gc_core/js/text.js +++ gc_core/js/text.js @@ -7,22 +7,21 @@ "use strict"; var text = { - _zEndOfSentence: new RegExp ('([.?!:;…][   .?!…»«“”"‘’)–—]+(?=[A-ZÉÈÎÔ])|.$)', "g"), - _zBeginOfParagraph: new RegExp ("^[-  –—.,;?!…]*", "ig"), + _zEndOfSentence: new RegExp ('[.?!:;…][   .?!…»«“”"‘’)–—]+(?=[A-ZÉÈÎÔ])', "g"), getSentenceBoundaries: function* (sText) { // generator: returns start and end of sentences found in - let mBeginOfSentence = this._zBeginOfParagraph.exec(sText); - let iStart = this._zBeginOfParagraph.lastIndex; + let iStart = 0; let m; while ((m = this._zEndOfSentence.exec(sText)) !== null) { yield [iStart, this._zEndOfSentence.lastIndex]; iStart = this._zEndOfSentence.lastIndex; } + yield [iStart, sText.length]; }, getParagraph: function* (sText, sSepParagraph = "\n") { // generator: returns paragraphs of text let iStart = 0; Index: gc_core/py/text.py ================================================================== --- gc_core/py/text.py +++ gc_core/py/text.py @@ -7,19 +7,19 @@ import re import textwrap from itertools import chain -_zEndOfSentence = re.compile(r'([.?!:;…]\W+(?=[A-ZÉÈÎÔ])|.$)') -_zBeginOfParagraph = re.compile(r"^\W*") +_zEndOfSentence = re.compile(r'[.?!:;…]\W+(?=[A-ZÉÈÎÔ])') def getSentenceBoundaries (sText): "generator: returns start and end of sentences found in " - iStart = _zBeginOfParagraph.match(sText).end() + iStart = 0 for m in _zEndOfSentence.finditer(sText): yield (iStart, m.end()) iStart = m.end() + yield (iStart, len(sText)) def getParagraph (sText): "generator: returns paragraphs of text" iStart = 0 Index: gc_lang/fr/rules.grx ================================================================== --- gc_lang/fr/rules.grx +++ gc_lang/fr/rules.grx @@ -1592,15 +1592,18 @@ !!! !!! Processeur: épuration des signes inutiles et quelques simplifications !! !!! !!! +# début de phrase +__(p_début_de_phrase)__ ^[ .?!:;–—•·… »«‘’“”\"'¿¡-]+ <<- ~>> * + # fin de phrase -__(p_fin_de_phrase)__ [.?!:;…][ .?!… »”")]*$ <<- ~>> * +__(p_fin_de_phrase)__ [ .?!:;–—•·… »«‘’“”\"'¿¡-]+$ <<- ~>> * # Guillemets et exposants -__(p_guillemets_exposants)__ [«»“”"„`¹²³⁴⁵⁶⁷⁸⁹⁰]+ <<- ~>> * +__(p_guillemets_exposants)__ [«»“”\"„`¹²³⁴⁵⁶⁷⁸⁹⁰]+ <<- ~>> * # Chapitres et références __(p_chapitre_référence)__ [\[({][\dIVXLCDM]+, \d+[\])}] [\[\(\{][\dIVXLCDM]+, \d+[\]\)\}] <<- ~>> * # le, la ou les chose(s)