Each time you upload XML, HTML, MD, or any other source files without a key-value structure, the predefined segmentation rules (SRX 2.0) are used for automatic content segmentation. Although, there might be situations when the default segmentation rules segment source files in contrast to the desired expectations. Az ilyen esetben az SRX 2.0 szabvány segítségével meghatározhatja az egyes forrásfájlokhoz a saját szegmentálási szabályait.
Szegmentálás módosítása
You can change segmentation in Sources > Files.
Open the project where you’d like to adjust the segmentation rules and go to Sources > Files.
Click (or right-click) on the needed file and select Settings.
In the appeared dialog, switch to the Parser configuration tab.
Select Enable content segmentation and Use custom segmentation rules.
Paste your SRX segmentation rules and click Save.
After you save your new segmentation rules, your source file will be automatically reimported and segmented according to these new rules.
Szegmentálási példák
Note: Regular expressions used in SRX rules must be compatible with PHP (PCRE2) and Node.js.
Egy tipikus SRX fájl az alábbihoz hasonló:
Mondatelválasztó módosítása az ázsiai nyelvekhez
A mondatok elválasztásaként általában a pontot használják. Although, for some Asian languages, it’s not the case. For example, the typical sentence separator in Chinese is an ideographic full stop (。). For such cases, you may want to use the following ruleset:
Szöveg tördelése kisebb részekre
In the following simple sentence, we’ll break down a case when segmenting one text piece into two (or more) strings is necessary.
Szöveg alapértelmezett szegmentálási szabályokkal:
Ez a minta mondat első része és ez a második része.
Szöveg az új szegmentálási szabályokkal:
Ez a minta mondat első része és ez a második része.
For this particular case, the following ruleset will break the initial sentence into two parts:
Szegmentációs szabályok létrehozása SRX szerkesztőkkel
Az SRX szegmentációs szabályok olyan eszközök segítségével hozhatók létre, mint a Ratel. Vizuális felülettel rendelkezik, ahol a szegmentálási szabályokat a semmiből is létrehozhatja, vagy a meglévőket szerkesztheti.