How to output each tweet as separate text file

Shaheen
Shaheen New Altair Community Member
edited November 5 in Community Q&A

Hi,

I am working on sentiment analysis in rapid miner using tweeter data. Can anyone help me how can I store each tweet as a seprate text file? First I am using "data to document" operator, while writing back each tweet as a seprate file I could not find such operator.

Your help is musch appreciated.

Thanks in advance 

Answers

  • Thomas_Ott
    Thomas_Ott New Altair Community Member

    Yes, I'd do it with a Loop opeartor and macros. Something like below:

     

    <?xml version="1.0" encoding="UTF-8"?><process version="7.3.001">
    <context>
    <input/>
    <output/>
    <macros/>
    </context>
    <operator activated="true" class="process" compatibility="7.3.001" expanded="true" name="Process">
    <process expanded="true">
    <operator activated="true" class="social_media:search_twitter" compatibility="7.3.000" expanded="true" height="68" name="Search Twitter" width="90" x="45" y="34">
    <parameter key="connection" value="ThomasOtt"/>
    <parameter key="query" value="RapidMiner"/>
    <parameter key="limit" value="10"/>
    </operator>
    <operator activated="true" class="extract_macro" compatibility="7.3.001" expanded="true" height="68" name="Extract Macro" width="90" x="179" y="34">
    <parameter key="macro" value="rows"/>
    <list key="additional_macros"/>
    </operator>
    <operator activated="true" class="loop" compatibility="7.3.001" expanded="true" height="82" name="Loop" width="90" x="313" y="34">
    <parameter key="set_iteration_macro" value="true"/>
    <parameter key="iterations" value="%{rows}"/>
    <process expanded="true">
    <operator activated="true" class="filter_example_range" compatibility="7.3.001" expanded="true" height="82" name="Filter Example Range" width="90" x="45" y="34">
    <parameter key="first_example" value="%{iteration}"/>
    <parameter key="last_example" value="%{iteration}"/>
    </operator>
    <operator activated="true" class="store" compatibility="7.3.001" expanded="true" height="68" name="Store" width="90" x="179" y="34">
    <parameter key="repository_entry" value="data/%{rows}_row_data"/>
    </operator>
    <connect from_port="input 1" to_op="Filter Example Range" to_port="example set input"/>
    <connect from_op="Filter Example Range" from_port="example set output" to_op="Store" to_port="input"/>
    <connect from_op="Store" from_port="through" to_port="output 1"/>
    <portSpacing port="source_input 1" spacing="0"/>
    <portSpacing port="source_input 2" spacing="0"/>
    <portSpacing port="sink_output 1" spacing="0"/>
    <portSpacing port="sink_output 2" spacing="0"/>
    </process>
    </operator>
    <connect from_op="Search Twitter" from_port="output" to_op="Extract Macro" to_port="example set"/>
    <connect from_op="Extract Macro" from_port="example set" to_op="Loop" to_port="input 1"/>
    <connect from_op="Loop" from_port="output 1" 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>
  • Shaheen
    Shaheen New Altair Community Member

    Thank you very much dear T-Bone,

    It is helpful, however, I want to write each row as a text file to be stored in local drive instead of rapidminer repository, from where I can imort data to train classification model.

    Thank you very much

  • Thomas_Ott
    Thomas_Ott New Altair Community Member

    Use the Data to Documents & Write Document operator instead of Store operator.