Grammalecte  Check-in [01d15e4e8d]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:[core] change the paragraph slicer
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk | core
Files: files | file ages | folders
SHA3-256:01d15e4e8d05904e5790d2eef53c4de022e9d8bf235b10e6454d2a95201f84b6
User & Date: olr 2019-06-10 07:14:49
Context
2019-06-10
17:22
[lo] graphic options for Writer: underling style and colors check-in: efad935afc user: olr tags: lo, trunk
07:14
[core] change the paragraph slicer check-in: 01d15e4e8d user: olr tags: core, trunk
07:08
[fr] faux positif check-in: 95fd136d5d user: olr tags: fr, trunk
Changes

Changes to gc_core/js/text.js.

5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/* global require, exports, console */

"use strict";


var text = {

    _zEndOfSentence: new RegExp ('[.?!:;…]+[   ]+[»”’]?(?=[«"“‘–—   ]?[A-ZÀÂÉÈÊÎÔÇ])', "g"),

    getSentenceBoundaries: function* (sText) {
        // generator: returns start and end of sentences found in <sText>
        let iStart = 0;
        let m;
        while ((m = this._zEndOfSentence.exec(sText)) !== null) {
            yield [iStart, this._zEndOfSentence.lastIndex];







|







5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/* global require, exports, console */

"use strict";


var text = {

    _zEndOfSentence: new RegExp ('[.?!:;…]+[»”’)]?[   ]+[»”’]?(?=[«"“‘–—   ]*[A-ZÀÂÉÈÊÎÔÇ])', "g"),

    getSentenceBoundaries: function* (sText) {
        // generator: returns start and end of sentences found in <sText>
        let iStart = 0;
        let m;
        while ((m = this._zEndOfSentence.exec(sText)) !== null) {
            yield [iStart, this._zEndOfSentence.lastIndex];

Changes to gc_core/py/text.py.

5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
"""

import re
import textwrap
from itertools import chain


_zEndOfSentence = re.compile(r'[.?!:;…]+[   ]+[»”’]?(?=[«"“‘–—   ]?[A-ZÀÂÉÈÊÎÔÇ])')

def getSentenceBoundaries (sText):
    "generator: returns start and end of sentences found in <sText>"
    iStart = 0
    for m in _zEndOfSentence.finditer(sText):
        yield (iStart, m.end())
        iStart = m.end()







|







5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
"""

import re
import textwrap
from itertools import chain


_zEndOfSentence = re.compile(r'[.?!:;…]+[»”’)]?[   ]+[»”’]?(?=[«"“‘–—   ]*[A-ZÀÂÉÈÊÎÔÇ])')

def getSentenceBoundaries (sText):
    "generator: returns start and end of sentences found in <sText>"
    iStart = 0
    for m in _zEndOfSentence.finditer(sText):
        yield (iStart, m.end())
        iStart = m.end()