Options

Error in date format

sukhsukh Member Posts: 43 Contributor II
edited October 2019 in Help
hi.

i am working with the data containing date and and text processing .
separately these processes are working well. but after joining these i get the error message for the variable "current" in which i am using date_now() to get the system date. but later i took date difference (date-of-post and  current) by converting it into date to numerical.
the process is as follows:

THE CSV file consists of :
DateOfPost- polynomial( e.g. 12/10/2006)
sentimentText- text(e.g. "i have bought a new car last week.it is very good")
id- integer(e.g. 1,2,3,4....................)

XML file is as follows:
<code>
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<process version="6.3.000">
 <context>
   <input/>
   <output/>
   <macros/>
 </context>
 <operator activated="true" class="process" compatibility="6.3.000" expanded="true" name="Process">
   <process expanded="true">
     <operator activated="true" class="retrieve" compatibility="6.3.000" expanded="true" height="60" name="Retrieve" width="90" x="45" y="30">
       <parameter key="repository_entry" value="c2'07"/>
     </operator>
     <operator activated="true" class="filter_examples" compatibility="6.3.000" expanded="true" height="94" name="Filter Examples" width="90" x="112" y="120">
       <list key="filters_list">
         <parameter key="filters_entry_key" value="id.eq.182"/>
         <parameter key="filters_entry_key" value="id.eq.319"/>
         <parameter key="filters_entry_key" value="id.eq.330"/>
         <parameter key="filters_entry_key" value="id.eq.345"/>
         <parameter key="filters_entry_key" value="id.eq.582"/>
         <parameter key="filters_entry_key" value="id.eq.733"/>
         <parameter key="filters_entry_key" value="id.eq.1927"/>
         <parameter key="filters_entry_key" value="id.eq.1987"/>
         <parameter key="filters_entry_key" value="id.eq.2269"/>
         <parameter key="filters_entry_key" value="id.eq.2312"/>
       </list>
     </operator>
     <operator activated="true" class="wordnet:open_wordnet_dictionary" compatibility="5.3.000" expanded="true" height="60" name="Open WordNet Dictionary" width="90" x="179" y="210">
       <parameter key="directory" value="/home/sukh/Documents/WordNet-3.0/dict"/>
     </operator>
     <operator activated="true" class="remember" compatibility="6.3.000" expanded="true" height="60" name="Remember" width="90" x="246" y="255">
       <parameter key="name" value="wordnet"/>
       <parameter key="io_object" value="WordnetDictionary"/>
     </operator>
     <operator activated="true" class="subprocess" compatibility="6.3.000" expanded="true" height="76" name="Subprocess" width="90" x="313" y="120">
       <process expanded="true">
         <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="multiply" compatibility="6.3.000" expanded="true" height="94" name="Multiply" width="90" x="45" y="210"/>
     <operator activated="true" class="nominal_to_date" compatibility="6.3.000" expanded="true" height="76" name="Nominal to Date" width="90" x="45" y="435">
       <parameter key="attribute_name" value="DateOfPost"/>
       <parameter key="date_format" value="MM/dd/yyyy"/>
     </operator>
     <operator activated="true" class="date_to_numerical" compatibility="6.3.000" expanded="true" height="76" name="Date to Numerical (2)" width="90" x="179" y="435">
       <parameter key="attribute_name" value="DateOfPost"/>
       <parameter key="time_unit" value="day"/>
       <parameter key="day_relative_to" value="epoch"/>
     </operator>
     <operator activated="true" class="generate_attributes" compatibility="6.3.000" expanded="true" height="76" name="Generate Attributes" width="90" x="179" y="345">
       <list key="function_descriptions">
         <parameter key="current" value="date_now()"/>
         <parameter key="current1" value="date_parse_custom(current,&quot;mm/dd/yyyy&quot;))"/>
       </list>
     </operator>
     <operator activated="true" class="date_to_numerical" compatibility="6.3.000" expanded="true" height="76" name="Date to Numerical" width="90" x="313" y="435">
       <parameter key="attribute_name" value="current"/>
       <parameter key="time_unit" value="day"/>
       <parameter key="day_relative_to" value="epoch"/>
     </operator>
     <operator activated="true" class="generate_attributes" compatibility="6.3.000" expanded="true" height="76" name="Generate Attributes (2)" width="90" x="380" y="300">
       <list key="function_descriptions">
         <parameter key="current" value="current-2034"/>
         <parameter key="Dtag" value="current-DateOfPost"/>
       </list>
     </operator>
     <operator activated="true" class="discretize_by_user_specification" compatibility="6.3.000" expanded="true" height="94" name="Discretize (2)" width="90" x="447" y="390">
       <parameter key="attribute_filter_type" value="single"/>
       <parameter key="attribute" value="Dtag"/>
       <list key="classes">
         <parameter key="present" value="375.0"/>
         <parameter key="past" value="Infinity"/>
       </list>
     </operator>
     <operator activated="true" class="text:process_document_from_data" compatibility="6.1.000" expanded="true" height="76" name="Process Documents from Data" width="90" x="246" y="30">
       <parameter key="keep_text" value="true"/>
       <list key="specify_weights"/>
       <process expanded="true">
         <operator activated="true" class="text:tokenize" compatibility="6.1.000" expanded="true" height="60" name="Tokenize" width="90" x="112" y="30"/>
         <operator activated="true" class="recall" compatibility="6.3.000" expanded="true" height="60" name="Recall" width="90" x="45" y="120">
           <parameter key="name" value="wordnet"/>
           <parameter key="io_object" value="WordnetDictionary"/>
           <parameter key="remove_from_store" value="false"/>
         </operator>
         <operator activated="true" class="wordnet:find_sentiment_wordnet" compatibility="5.3.000" expanded="true" height="76" name="Extract Sentiment (English)" width="90" x="246" y="75"/>
         <operator activated="true" class="text:stem_dictionary" compatibility="6.1.000" expanded="true" height="76" name="Stem (Dictionary)" width="90" x="450" y="30">
           <parameter key="file" value="/home/sukh/Desktop/stemhindi"/>
         </operator>
         <connect from_port="document" to_op="Tokenize" to_port="document"/>
         <connect from_op="Tokenize" from_port="document" to_op="Extract Sentiment (English)" to_port="document"/>
         <connect from_op="Recall" from_port="result" to_op="Extract Sentiment (English)" to_port="dictionary"/>
         <connect from_op="Extract Sentiment (English)" from_port="document" to_op="Stem (Dictionary)" to_port="document"/>
         <connect from_op="Stem (Dictionary)" from_port="document" to_port="document 1"/>
         <portSpacing port="source_document" spacing="0"/>
         <portSpacing port="sink_document 1" spacing="0"/>
         <portSpacing port="sink_document 2" spacing="0"/>
       </process>
     </operator>
     <operator activated="true" class="generate_attributes" compatibility="6.3.000" expanded="true" height="76" name="Generate Attributes (3)" width="90" x="380" y="30">
       <list key="function_descriptions">
         <parameter key="present" value="(length(text)-length(replaceAll(text,&quot;present&quot;,&quot;&quot;)))/length(&quot;present&quot;)"/>
         <parameter key="past" value="(length(text)-length(replaceAll(text,&quot;past&quot;,&quot;&quot;)))/length(&quot;past&quot;)"/>
         <parameter key="future" value="(length(text)-length(replaceAll(text,&quot;future&quot;,&quot;&quot;)))/length(&quot;future&quot;)"/>
         <parameter key="Ttag" value="if(present==max(present,past,future),&quot;present&quot;,if(past==max(present,past,future),&quot;past&quot;,if(future==max(present,past,future),&quot;future&quot;,0)))"/>
       </list>
     </operator>
     <operator activated="true" class="join" compatibility="6.3.000" expanded="true" height="76" name="Join" width="90" x="514" y="165">
       <parameter key="join_type" value="outer"/>
       <parameter key="use_id_attribute_as_key" value="false"/>
       <list key="key_attributes">
         <parameter key="id" value="id"/>
       </list>
       <parameter key="keep_both_join_attributes" value="true"/>
     </operator>
     <operator activated="true" class="generate_attributes" compatibility="6.3.000" expanded="true" height="76" name="Generate Attributes (5)" width="90" x="514" y="30">
       <list key="function_descriptions">
         <parameter key="new1" value="if(Ttag==&quot;present&quot;,if(Dtag==&quot;past&quot;,&quot;past&quot;,if(Dtag==&quot;present&quot;,&quot;present&quot;,0)),&quot;z&quot;)"/>
         <parameter key="new" value="if(Ttag==&quot;past&quot;,if(Dtag==&quot;past&quot;,&quot;past&quot;,if(Dtag==&quot;present&quot;,&quot;past&quot;,0)),new1)"/>
         <parameter key="Temptag" value="if(Ttag==&quot;future&quot;,if(Dtag==&quot;past&quot;,&quot;past&quot;,if(Dtag==&quot;present&quot;,&quot;future&quot;,0)),new)"/>
       </list>
     </operator>
     <connect from_op="Retrieve" from_port="output" to_op="Filter Examples" to_port="example set input"/>
     <connect from_op="Filter Examples" from_port="example set output" to_op="Multiply" to_port="input"/>
     <connect from_op="Open WordNet Dictionary" from_port="dictionary" to_op="Remember" to_port="store"/>
     <connect from_op="Remember" from_port="stored" to_op="Subprocess" to_port="in 1"/>
     <connect from_op="Subprocess" from_port="out 1" to_op="Process Documents from Data" to_port="word list"/>
     <connect from_op="Multiply" from_port="output 1" to_op="Process Documents from Data" to_port="example set"/>
     <connect from_op="Multiply" from_port="output 2" to_op="Nominal to Date" to_port="example set input"/>
     <connect from_op="Nominal to Date" from_port="example set output" to_op="Date to Numerical (2)" to_port="example set input"/>
     <connect from_op="Date to Numerical (2)" from_port="example set output" to_op="Generate Attributes" to_port="example set input"/>
     <connect from_op="Generate Attributes" from_port="example set output" to_op="Date to Numerical" to_port="example set input"/>
     <connect from_op="Date to Numerical" from_port="example set output" to_op="Generate Attributes (2)" to_port="example set input"/>
     <connect from_op="Generate Attributes (2)" from_port="example set output" to_op="Discretize (2)" to_port="example set input"/>
     <connect from_op="Discretize (2)" from_port="example set output" to_op="Join" to_port="right"/>
     <connect from_op="Process Documents from Data" from_port="example set" to_op="Generate Attributes (3)" to_port="example set input"/>
     <connect from_op="Generate Attributes (3)" from_port="example set output" to_op="Join" to_port="left"/>
     <connect from_op="Join" from_port="join" to_op="Generate Attributes (5)" to_port="example set input"/>
     <connect from_op="Generate Attributes (5)" from_port="example set output" to_port="result 1"/>
     <portSpacing port="source_input 1" spacing="0"/>
     <portSpacing port="sink_result 1" spacing="0"/>
     <portSpacing port="sink_result 2" spacing="0"/>
   </process>
 </operator>
</process>
</code>

Kindly help me for the same.


Thanks and Regards:
Sukh
Tagged:

Answers

  • Options
    awchisholmawchisholm RapidMiner Certified Expert, Member Posts: 458 Unicorn
    Hello

    The date_now() function returns an object of type "Date time". Using this with the date_parse_custom() function will result in an error because this function is expecting a string containing the date.

    regards

    Andrew
Sign In or Register to comment.