Options

[SOLVED] Strange issues with Replace tokens operator

kaymankayman Member Posts: 662 Unicorn
edited November 2018 in Help
Hi there I'm running some processes to convert e-tailer information into structured tables, works well but I stumbled upon something weird.

In short the process is as follows (using web mining / text processing functions)

1. Crawl the site(s), clean up the pages, and make it one big XHTML
2. Use some XSLT to convert the XHTML to structured XML
3.  Use some additional Replace Tokens operators to perform finetuning
4. Store

The issue is that when I store the final content in a repository there are 2 content streams inside, the one before the replace tokens block, and the cleaned one.

In other words, the results overview is giving the correct information, but the repository is storing the input data of the replace token operator on top of the output data.

The xml looks as below before entering the replace token operator

<models>
<model>
.. some elements ..
<productRef>MODELNAME, 121 CM (48 ZOLL), 1080P (FULL HD) LED FERNSEHER</productRef>
.. some elements..
</model>
</models>
the process will replace the productRef element with a few other elements and looks as follows when leaving it :

<models>
<model>
.. some elements ..
    <productSubCategory>Full HD</productSubCategory>
    <productScreenSize>48 inch</productScreenSize>
    <productName>MODELNAME</productName>
.. some elements..
</model>
</models>
Exactly as intended, the productRef element has been replaced with some other elements. However, this is only when using the 'show document result'. When storing this doc data only the original data is provided. When analyzing the repository (using a text editor) it is clear the original data is stored first, followed by the cleaned data. But the cleaned data seems un-accessible.

Any idea what might be causing this ? Do I need to convert the content before storing it or is this a bug ?

full working example can be downloaded here : http://www.freeuploadsite.com/do.php?id=70466

code used :
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<process version="5.3.015">
 <context>
   <input/>
   <output/>
   <macros/>
 </context>
 <operator activated="true" class="process" compatibility="5.3.015" expanded="true" name="Process">
   <process expanded="true">
     <operator activated="true" class="retrieve" compatibility="5.3.015" expanded="true" height="60" name="Retrieve xhtml" width="90" x="45" y="30">
       <parameter key="repository_entry" value="xhtml"/>
     </operator>
     <operator activated="true" class="subprocess" compatibility="5.3.015" expanded="true" height="76" name="make XML" width="90" x="179" y="30">
       <process expanded="true">
         <operator activated="true" class="text:create_document" compatibility="5.3.002" expanded="true" height="60" name="makeTags1" width="90" x="45" y="120">
           <parameter key="text" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&#10;&lt;xsl:stylesheet version=&quot;1.0&quot; xmlns:xsl=&quot;http://www.w3.org/1999/XSL/Transform&quot;&gt;&#10;&#9;&lt;xsl:output method=&quot;xml&quot; version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; omit-xml-declaration=&quot;yes&quot;/&gt;&#10;&#9;&lt;xsl:template match=&quot;/&quot;&gt;&#10;&#9;&#9;&lt;models&gt;&#10;&#9;&#9;&#9;&#9;&lt;xsl:for-each select=&quot;//body/article&quot;&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;xsl:variable name=&quot;theAccount&quot;&gt;&#10;&#9;&#9;&#9;&#9;&#9;&#9;&lt;xsl:value-of select=&quot;normalize-space(div[@id='account'])&quot;/&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;/xsl:variable&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;xsl:variable name=&quot;theUrl&quot;&gt;&#10;&#9;&#9;&#9;&#9;&#9;&#9;&lt;xsl:value-of select=&quot;normalize-space(div[@id='url'])&quot;/&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;/xsl:variable&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;xsl:variable name=&quot;theCat&quot;&gt;&#10;&#9;&#9;&#9;&#9;&#9;&#9;&lt;xsl:text&gt;Television&lt;/xsl:text&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;/xsl:variable&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;xsl:variable name=&quot;theSubCat&quot;&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;/xsl:variable&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;xsl:variable name=&quot;theActivePage&quot;&gt;&#10;&#9;&#9;&#9;&#9;&#9;&#9;&lt;xsl:choose&gt;&#10;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&lt;xsl:when test=&quot;contains($theUrl,'p=')&quot;&gt;&#10;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&lt;xsl:value-of select=&quot;substring-before(substring-after($theUrl,'p='),'&amp;amp;')&quot;/&gt;&#10;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&lt;/xsl:when&gt;&#10;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&lt;xsl:otherwise&gt;&#10;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&lt;xsl:text&gt;1&lt;/xsl:text&gt;&#10;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&lt;/xsl:otherwise&gt;&#10;&#9;&#9;&#9;&#9;&#9;&#9;&lt;/xsl:choose&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;/xsl:variable&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;xsl:for-each select=&quot;.//section[@id='san_resultSection']/article&quot;&gt;&#10;&#9;&#9;&#9;&#9;&#9;&#9;&lt;model&gt;&#10;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&lt;productAccount&gt;&#10;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&lt;xsl:value-of select=&quot;$theAccount&quot;/&gt;&#10;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&lt;/productAccount&gt;&#10;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&lt;productURL&gt;&#10;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&lt;xsl:value-of select=&quot;$theUrl&quot;/&gt;&#10;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&lt;/productURL&gt;&#10;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&lt;productCategory&gt;&#10;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&lt;xsl:value-of select=&quot;$theCat&quot;/&gt;&#10;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&lt;/productCategory&gt;&#10;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&lt;!--&lt;productSubCategory&gt;&#10;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&lt;xsl:value-of select=&quot;$theSubCat&quot;/&gt;&#10;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&lt;/productSubCategory&gt;--&gt;&#10;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&lt;productActivePage&gt;&#10;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&lt;xsl:value-of select=&quot;normalize-space($theActivePage)&quot;/&gt;&#10;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&lt;/productActivePage&gt;&#10;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&lt;productRank&gt;&#10;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&lt;xsl:value-of select=&quot;position()&quot;/&gt;&#10;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&lt;/productRank&gt;&#10;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&lt;productCode&gt;&#10;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&lt;xsl:value-of select=&quot;@data-productid&amp;quot;/&gt;&#10;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&lt;/productCode&gt;&#10;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&lt;productDescription&gt;&#10;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&lt;xsl:value-of select=&quot;normalize-space(a)&quot;/&gt;&#10;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&lt;/productDescription&gt;&#10;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&lt;productPage&gt;&#10;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&lt;xsl:value-of select=&quot;concat('https://www.otto.de',a/@href)&quot;/&gt;&#10;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&lt;/productPage&gt;&#10;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&lt;productVarID&gt;&#10;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&lt;xsl:value-of select=&quot;.//@data-price-defining-variation-id&amp;quot;/&gt;&#10;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&lt;/productVarID&gt;&#10;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&lt;productJSON&gt;&#10;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&lt;xsl:value-of select=&quot;concat('https://www.otto.de',a/@data-json-target)&quot;/&gt;&#10;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&lt;/productJSON&gt;&#10;&#9;&#9;&#9;&#9;&#9;&#9;&lt;/model&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;/xsl:for-each&gt;&#10;&#9;&#9;&#9;&#9;&lt;/xsl:for-each&gt;&#10;&#9;&#9;&lt;/models&gt;&#10;&#9;&lt;/xsl:template&gt;&#10;&lt;/xsl:stylesheet&gt;"/>
         </operator>
         <operator activated="true" class="text:process_xslt" compatibility="5.3.002" expanded="true" height="76" name="Process (6)" width="90" x="180" y="30"/>
         <operator activated="true" class="text:create_document" compatibility="5.3.002" expanded="true" height="60" name="getModelInfo (3)" width="90" x="179" y="120">
           <parameter key="text" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&#10;&lt;xsl:stylesheet version=&quot;1.0&quot; xmlns:xsl=&quot;http://www.w3.org/1999/XSL/Transform&quot;&gt;&#10;&#9;&lt;xsl:output method=&quot;xml&quot; version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; omit-xml-declaration=&quot;yes&quot;/&gt;&#10;&#9;&lt;xsl:param name=&quot;smallcase&quot; select=&quot;'abcdefghijklmnopqrstuvwxyz®™'&quot;/&gt;&#10;&#9;&lt;xsl:param name=&quot;uppercase&quot; select=&quot;'ABCDEFGHIJKLMNOPQRSTUVWXYZ  '&quot;/&gt;&#10;&#9;&lt;xsl:template match=&quot;/&quot;&gt;&#10;&#9;&#9;&lt;xsl:copy&gt;&#10;&#9;&#9;&#9;&lt;xsl:apply-templates select=&quot;@*|node()&amp;quot;/&gt;&#10;&#9;&#9;&lt;/xsl:copy&gt;&#10;&#9;&lt;/xsl:template&gt;&#10;&#9;&lt;xsl:template match=&quot;@*|node()&amp;quot;&gt;&#10;&#9;&#9;&lt;xsl:copy&gt;&#10;&#9;&#9;&#9;&lt;xsl:apply-templates select=&quot;@*|node()&amp;quot;/&gt;&#10;&#9;&#9;&lt;/xsl:copy&gt;&#10;&#9;&lt;/xsl:template&gt;&#10;&#9;&lt;xsl:template match=&quot;productDescription&quot;&gt;&#10;&#9;&#9;&lt;xsl:copy&gt;&#10;&#9;&#9;&#9;&lt;xsl:apply-templates select=&quot;@*|node()&amp;quot;/&gt;&#10;&#9;&#9;&lt;/xsl:copy&gt;&#10;&#9;&#9;&lt;xsl:call-template name=&quot;makeProductDescription&quot;/&gt;&#10;&#9;&lt;/xsl:template&gt;&#10;&#9;&lt;xsl:template name=&quot;makeProductDescription&quot;&gt;&#10;&#9;&#9;&lt;xsl:variable name=&quot;theString&quot; select=&quot;translate(normalize-space(.), $smallcase, $uppercase)&quot;/&gt;&#10;&#9;&#9;&lt;xsl:variable name=&quot;theBrand&quot;&gt;&#10;&#9;&#9;&#9;&lt;xsl:choose&gt;&#10;&#9;&#9;&#9;&#9;&lt;xsl:when test=&quot;starts-with($theString,'ACOUSTIC SOLUTIONS')&quot;&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;xsl:text&gt;ACOUSTIC SOLUTIONS&lt;/xsl:text&gt;&#10;&#9;&#9;&#9;&#9;&lt;/xsl:when&gt;&#10;&#9;&#9;&#9;&#9;&lt;xsl:when test=&quot;starts-with($theString,'ADVANCE ACOUSTIC')&quot;&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;xsl:text&gt;ADVANCE ACOUSTIC&lt;/xsl:text&gt;&#10;&#9;&#9;&#9;&#9;&lt;/xsl:when&gt;&#10;&#9;&#9;&#9;&#9;&lt;xsl:when test=&quot;starts-with($theString,'AUDIO PRO')&quot;&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;xsl:text&gt;AUDIO PRO&lt;/xsl:text&gt;&#10;&#9;&#9;&#9;&#9;&lt;/xsl:when&gt;&#10;&#9;&#9;&#9;&#9;&lt;xsl:when test=&quot;starts-with($theString,'AUDIO TECHNICA')&quot;&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;xsl:text&gt;AUDIO TECHNICA&lt;/xsl:text&gt;&#10;&#9;&#9;&#9;&#9;&lt;/xsl:when&gt;&#10;&#9;&#9;&#9;&#9;&lt;xsl:when test=&quot;starts-with($theString,'BANG &amp;amp; OLUFSEN')&quot;&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;xsl:text&gt;BANG &amp;amp; OLUFSEN&lt;/xsl:text&gt;&#10;&#9;&#9;&#9;&#9;&lt;/xsl:when&gt;&#10;&#9;&#9;&#9;&#9;&lt;xsl:when test=&quot;starts-with($theString,'DIGITAL SILENCE')&quot;&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;xsl:text&gt;DIGITAL SILENCE&lt;/xsl:text&gt;&#10;&#9;&#9;&#9;&#9;&lt;/xsl:when&gt;&#10;&#9;&#9;&#9;&#9;&lt;xsl:when test=&quot;starts-with($theString,'ENERGY SISTEM')&quot;&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;xsl:text&gt;ENERGY SISTEM&lt;/xsl:text&gt;&#10;&#9;&#9;&#9;&#9;&lt;/xsl:when&gt;&#10;&#9;&#9;&#9;&#9;&lt;xsl:when test=&quot;starts-with($theString,'FRESH N REBEL')&quot;&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;xsl:text&gt;FRESH N REBEL&lt;/xsl:text&gt;&#10;&#9;&#9;&#9;&#9;&lt;/xsl:when&gt;&#10;&#9;&#9;&#9;&#9;&lt;xsl:when test=&quot;starts-with($theString,'GO PRO')&quot;&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;xsl:text&gt;GO PRO&lt;/xsl:text&gt;&#10;&#9;&#9;&#9;&#9;&lt;/xsl:when&gt;&#10;&#9;&#9;&#9;&#9;&lt;xsl:when test=&quot;starts-with($theString,'HARMAN KARDON')&quot;&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;xsl:text&gt;HARMAN KARDON&lt;/xsl:text&gt;&#10;&#9;&#9;&#9;&#9;&lt;/xsl:when&gt;&#10;&#9;&#9;&#9;&#9;&lt;xsl:when test=&quot;starts-with($theString,'HOUSE OF MARLEY')&quot;&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;xsl:text&gt;HOUSE OF MARLEY&lt;/xsl:text&gt;&#10;&#9;&#9;&#9;&#9;&lt;/xsl:when&gt;&#10;&#9;&#9;&#9;&#9;&lt;xsl:when test=&quot;starts-with($theString,'JOHN LEWIS')&quot;&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;xsl:text&gt;JOHN LEWIS&lt;/xsl:text&gt;&#10;&#9;&#9;&#9;&#9;&lt;/xsl:when&gt;&#10;&#9;&#9;&#9;&#9;&lt;xsl:when test=&quot;starts-with($theString,'LIQUID IMAGE')&quot;&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;xsl:text&gt;LIQUID IMAGE&lt;/xsl:text&gt;&#10;&#9;&#9;&#9;&#9;&lt;/xsl:when&gt;&#10;&#9;&#9;&#9;&#9;&lt;xsl:when test=&quot;starts-with($theString,'KIDZ GEAR')&quot;&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;xsl:text&gt;KIDZ GEAR&lt;/xsl:text&gt;&#10;&#9;&#9;&#9;&#9;&lt;/xsl:when&gt;&#10;&#9;&#9;&#9;&#9;&lt;xsl:when test=&quot;starts-with($theString,'MONSTER CABLE')&quot;&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;xsl:text&gt;MONSTER CABLE&lt;/xsl:text&gt;&#10;&#9;&#9;&#9;&#9;&lt;/xsl:when&gt;&#10;&#9;&#9;&#9;&#9;&lt;xsl:when test=&quot;starts-with($theString,'SMS AUDIO')&quot;&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;xsl:text&gt;SMS AUDIO&lt;/xsl:text&gt;&#10;&#9;&#9;&#9;&#9;&lt;/xsl:when&gt;&#10;&#9;&#9;&#9;&#9;&lt;xsl:when test=&quot;starts-with($theString,'TED BAKER')&quot;&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;xsl:text&gt;TED BAKER&lt;/xsl:text&gt;&#10;&#9;&#9;&#9;&#9;&lt;/xsl:when&gt;&#10;&#9;&#9;&#9;&#9;&lt;xsl:when test=&quot;starts-with($theString,'THUMBS UP')&quot;&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;xsl:text&gt;THUMBS UP&lt;/xsl:text&gt;&#10;&#9;&#9;&#9;&#9;&lt;/xsl:when&gt;&#10;&#9;&#9;&#9;&#9;&lt;xsl:when test=&quot;starts-with($theString,'ULTIMATE EARS')&quot;&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;xsl:text&gt;ULTIMATE EARS&lt;/xsl:text&gt;&#10;&#9;&#9;&#9;&#9;&lt;/xsl:when&gt;&#10;&#9;&#9;&#9;&#9;&lt;xsl:when test=&quot;starts-with($theString,'URBAN REVOLT')&quot;&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;xsl:text&gt;URBAN REVOLT&lt;/xsl:text&gt;&#10;&#9;&#9;&#9;&#9;&lt;/xsl:when&gt;&#10;&#9;&#9;&#9;&#9;&lt;xsl:when test=&quot;starts-with($theString,'VIEW QUEST')&quot;&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;xsl:text&gt;VIEW QUEST&lt;/xsl:text&gt;&#10;&#9;&#9;&#9;&#9;&lt;/xsl:when&gt;&#10;&#9;&#9;&#9;&#9;&lt;xsl:otherwise&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;xsl:value-of select=&quot;substring-before($theString,' ')&quot;/&gt;&#10;&#9;&#9;&#9;&#9;&lt;/xsl:otherwise&gt;&#10;&#9;&#9;&#9;&lt;/xsl:choose&gt;&#10;&#9;&#9;&lt;/xsl:variable&gt;&#10;&#9;&#9;&lt;productBrand&gt;&#10;&#9;&#9;&#9;&lt;xsl:value-of select=&quot;$theBrand&quot;/&gt;&#10;&#9;&#9;&lt;/productBrand&gt;&#10;&#9;&#9;&lt;productRef&gt;&#10;&#9;&#9;&#9;&lt;xsl:value-of select=&quot;normalize-space(substring-after($theString,$theBrand))&quot;/&gt;&#10;&#9;&#9;&lt;/productRef&gt;&#10;&#9;&lt;/xsl:template&gt;&#10;&lt;/xsl:stylesheet&gt;"/>
         </operator>
         <operator activated="true" class="text:process_xslt" compatibility="5.3.002" expanded="true" height="76" name="Process (7)" width="90" x="313" y="30"/>
         <operator activated="true" class="store" compatibility="5.3.015" expanded="true" height="60" name="sub" width="90" x="447" y="30">
           <parameter key="repository_entry" value="xml_tmp"/>
         </operator>
         <operator activated="true" class="text:replace_tokens" compatibility="5.3.002" expanded="true" height="60" name="clean4model (2)" width="90" x="581" y="30">
           <list key="replace_dictionary">
             <parameter key="&lt;productRef&gt;(?:BRAVIA\s|VIERA\s|FINE\sARTS\s)([^&lt;]*)&lt;/productRef&gt;" value="&lt;productRef&gt;$1&lt;/productRef&gt;"/>
             <parameter key="&lt;productRef&gt;([^,]*), [0-9]+ CM [^&lt;]*&lt;/productRef&gt;" value="&lt;productName&gt;$1&lt;/productName&gt;"/>
             <parameter key="&lt;productRef&gt;[^&lt;]*»([^«]*)«[^&lt;]*&lt;/productRef&gt;" value="&lt;productName&gt;$1&lt;/productName&gt;"/>
             <parameter key="&lt;productRef&gt;[^&lt;]*\s&quot;([^&quot;]*)&quot;\s[^&lt;]*&lt;\/productRef&gt;" value="&lt;productName&gt;$1&lt;/productName&gt;"/>
             <parameter key="&lt;productName&gt;(\d{2})\s?(\w{3})\s?(\d{3,4})\s?(\w{2})([^&lt;]*)&lt;/productName&gt;" value="&lt;productName&gt;$1$2$3$4$5&lt;/productName&gt;"/>
             <parameter key="&lt;productRef&gt;([A-Z0-9]+-[A-Z0-9]+)[^&lt;]*&lt;\/productRef&gt;" value="&lt;productName&gt;$1&lt;/productName&gt;"/>
             <parameter key="&lt;productRef&gt;(.*?)&lt;\/productRef&gt;" value="&lt;productName&gt;ZZZ-UNDEFINED | $1&lt;/productName&gt;"/>
           </list>
         </operator>
         <operator activated="true" class="text:replace_tokens" compatibility="5.3.002" expanded="true" height="60" name="clean4features (2)" width="90" x="715" y="30">
           <list key="replace_dictionary">
             <parameter key="(&lt;productDescription&gt;[^&lt;]*\()(\d+(?:,\d+)?)( Zoll[^&lt;]*&lt;/productDescription&gt;)" value="$1$2$3&lt;productScreenSize&gt;$2 inch&lt;/productScreenSize&gt;"/>
             <parameter key="(&lt;productDescription&gt;[^&lt;|\d]*)(\d+)(&quot;[^&lt;]*&lt;/productDescription&gt;)" value="$1$2$3&lt;productScreenSize&gt;$2 inch&lt;/productScreenSize&gt;"/>
             <parameter key="(&lt;productDescription&gt;[^&lt;]*Full HD[^&lt;]*&lt;/productDescription&gt;)" value="&lt;productSubCategory&gt;Full HD&lt;/productSubCategory&gt;$1"/>
             <parameter key="(&lt;productDescription&gt;[^&lt;]*HD-ready[^&lt;]*&lt;/productDescription&gt;)" value="&lt;productSubCategory&gt;HD-ready&lt;/productSubCategory&gt;$1"/>
             <parameter key="(&lt;productDescription&gt;[^&lt;]*(?:4K\s|Ultra HD|SUHD)[^&lt;]*&lt;/productDescription&gt;)" value="&lt;productSubCategory&gt;4K&lt;/productSubCategory&gt;$1"/>
             <parameter key="(&lt;productDescription&gt;[^&lt;]*»[A-Z-]+)(\d+)([^&lt;]*&lt;/productDescription&gt;)(?!&lt;productScreenSize&gt;)" value="$1$2$3&lt;productScreenSize&gt;$2 inch&lt;/productScreenSize&gt;"/>
             <parameter key="(&lt;productDescription&gt;[^&lt;]*\()(\d+)(&quot;\)[^&lt;]*&lt;/productDescription&gt;)" value="$1$2$3&lt;productScreenSize&gt;$2 inch&lt;/productScreenSize&gt;"/>
           </list>
         </operator>
         <connect from_port="in 1" to_op="Process (6)" to_port="document"/>
         <connect from_op="makeTags1" from_port="output" to_op="Process (6)" to_port="xslt document"/>
         <connect from_op="Process (6)" from_port="document" to_op="Process (7)" to_port="document"/>
         <connect from_op="getModelInfo (3)" from_port="output" to_op="Process (7)" to_port="xslt document"/>
         <connect from_op="Process (7)" from_port="document" to_op="sub" to_port="input"/>
         <connect from_op="sub" from_port="through" to_op="clean4model (2)" to_port="document"/>
         <connect from_op="clean4model (2)" from_port="document" to_op="clean4features (2)" to_port="document"/>
         <connect from_op="clean4features (2)" from_port="document" to_port="out 1"/>
         <portSpacing port="source_in 1" spacing="0"/>
         <portSpacing port="source_in 2" spacing="0"/>
         <portSpacing port="sink_out 1" spacing="0"/>
         <portSpacing port="sink_out 2" spacing="0"/>
       </process>
     </operator>
     <operator activated="true" class="store" compatibility="5.3.015" expanded="true" height="60" name="Store XML" width="90" x="313" y="30">
       <parameter key="repository_entry" value="xml"/>
     </operator>
     <connect from_op="Retrieve xhtml" from_port="output" to_op="make XML" to_port="in 1"/>
     <connect from_op="make XML" from_port="out 1" to_op="Store XML" to_port="input"/>
     <portSpacing port="source_input 1" spacing="0"/>
     <portSpacing port="sink_result 1" spacing="0"/>
   </process>
 </operator>
</process>
if I save as xml the content looks as follows :

<Document>
<default>
<metaData class="linked-hash-map" id="4"></metaData>
<text>my-original-data</text>
<tokenSequence id="5">
<com.rapidminer.operator.text.Token id="6">
<token>my-cleaned-data</token>
<weight>1.0</weight>
</com.rapidminer.operator.text.Token>
</tokenSequence>
</default>
</Document>
So maybe the correct question is more like : how can I get / store the token data as text instead of the (original) text data, which seems to be the default option ?

Answers

  • Options
    kaymankayman Member Posts: 662 Unicorn
    Well, apparently combining documents did the trick. Not sure why but doing that 'removed' the original text and provided the tokenized data. Hopefully this is useful for other too.
Sign In or Register to comment.