RapidMiner

How to correct the wrong words?

Wisdom logo Registration now open for RapidMiner Wisdom Americas | New Orleans | October 10-12, 2018   Learn More

Re: How to correct the wrong words?

Hi Student_compute,

The 'pip' command is installed with Python.
So first install Python (Python 3.x) via
Anaconda.

Regards,

Lionel.
Contributor II student_compute
Contributor II

Re: How to correct the wrong words?

Hello
But I installed Python first.
How should I do now?
Thank you my friend

 

Contributor II jozeftomas_2020
Contributor II

Re: How to correct the wrong words?

Hello, thank you very much for your response and kindness I've got it from Twitter, in the photo above I have a search twitter operator before nominal to text. This Can you tell what the problem is? And how can I run the preprocess code on my tweets in RapidMiner? https://www.kdnuggets.com/2018/03/text-data-preprocessing-walkthrough-python.html Thanks if you get started With respect and dedication

Re: How to correct the wrong words?

Hi @jozeftomas_2020,

 

It will be very hard for us to understand your bug without your process, can you share it ?

and what you want to do in fine ?, correct the mispelled tweets ??

 

Regards,

 

Lionel

Re: How to correct the wrong words?

Hi @student_compute,

 

If you have, effectively, installed Python, 'pip' must be installed too. So I see only one solution : 

You have to update your "environment variables" : 

1/

 - Search the pip.exe file on your computer. it is by default located in C:\Users\username\Anacondax\Scripts or C:\Users\username\Pythonx\Scripts. (where x = 2 or 3 according to the version of Python you installed).

or

 - Type 'pip.exe' (with quote) in the search bar of windows 10 (bottom-left), then right click on the result and select open the location of the file.

 

 

2/ Then (here on Windows 10): 

 - open an explorer window

 

Pip_Installation.png

then click on properties

 

Pip_Installation_2.png

 

then

 

Pip_Installation_3.png

 

then


Pip_Installation_4.pngikk

 

then

Pip_Installation_5.pngI

I hope it helps,

 

Regards,

 

Lionel

 

 

 

 

 

 

 

Contributor II jozeftomas_2020
Contributor II

Re: How to correct the wrong words?

Hello
This is my process
I want to correct spelling mistakes in any tweets. And then I can do kmesan clustering. But I'm new to Python.
And in the RapidMiner program, I do not know how to write code for Python to achieve this goal.
Please, dear friend, if possible
With respect
I will be grateful . I'm waiting for your help

 

Re: How to correct the wrong words?

Hi @jozeftomas_2020,

 

Here the operational process to correct mispelled tweets : 

<?xml version="1.0" encoding="UTF-8"?><process version="8.2.001">
  <context>
    <input/>
    <output/>
    <macros/>
  </context>
  <operator activated="true" class="process" compatibility="8.2.001" expanded="true" name="Process">
    <process expanded="true">
      <operator activated="true" class="social_media:search_twitter" compatibility="8.0.010" expanded="true" height="68" name="Search Twitter" width="90" x="45" y="136">
        <parameter key="connection" value="dkk"/>
        <parameter key="query" value="iphone"/>
        <parameter key="limit" value="10"/>
        <parameter key="language" value="en"/>
      </operator>
      <operator activated="true" class="select_attributes" compatibility="8.2.001" expanded="true" height="82" name="Select Attributes" width="90" x="179" y="136">
        <parameter key="attribute_filter_type" value="subset"/>
        <parameter key="attributes" value="Text"/>
      </operator>
      <operator activated="true" class="nominal_to_text" compatibility="8.2.001" expanded="true" height="82" name="Nominal to Text" width="90" x="313" y="136"/>
      <operator activated="true" class="text:process_document_from_data" compatibility="8.1.000" expanded="true" height="82" name="Process Documents from Data" width="90" x="447" y="136">
        <parameter key="keep_text" value="true"/>
        <parameter key="prune_method" value="percentual"/>
        <parameter key="prune_below_percent" value="2.0"/>
        <parameter key="prune_above_percent" value="70.0"/>
        <list key="specify_weights"/>
        <process expanded="true">
          <operator activated="true" class="text:transform_cases" compatibility="8.1.000" expanded="true" height="68" name="Transform Cases" width="90" x="45" y="34"/>
          <operator activated="true" class="text:tokenize" compatibility="8.1.000" expanded="true" height="68" name="Tokenize" width="90" x="179" y="34"/>
          <operator activated="true" class="text:filter_stopwords_english" compatibility="8.1.000" expanded="true" height="68" name="Filter Stopwords (English)" width="90" x="313" y="34"/>
          <operator activated="true" class="text:filter_by_length" compatibility="8.1.000" expanded="true" height="68" name="Filter Tokens (by Length)" width="90" x="447" y="34"/>
          <operator activated="true" class="text:stem_porter" compatibility="8.1.000" expanded="true" height="68" name="Stem (Porter)" width="90" x="581" y="34"/>
          <connect from_port="document" to_op="Transform Cases" to_port="document"/>
          <connect from_op="Transform Cases" from_port="document" to_op="Tokenize" to_port="document"/>
          <connect from_op="Tokenize" from_port="document" to_op="Filter Stopwords (English)" to_port="document"/>
          <connect from_op="Filter Stopwords (English)" from_port="document" to_op="Filter Tokens (by Length)" to_port="document"/>
          <connect from_op="Filter Tokens (by Length)" from_port="document" to_op="Stem (Porter)" to_port="document"/>
          <connect from_op="Stem (Porter)" 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="set_macros" compatibility="8.2.001" expanded="true" height="82" name="Set Text Atribute" width="90" x="514" y="238">
        <list key="macros">
          <parameter key="textAttribute" value="'text'"/>
        </list>
      </operator>
      <operator activated="true" class="python_scripting:execute_python" compatibility="7.4.000" expanded="true" height="82" name="Execute Python" width="90" x="581" y="136">
        <parameter key="script" value="import pandas&#10;from textblob import TextBlob&#10;&#10;Text_Attribute = %{textAttribute}&#10;&#10;&#10;def spellingCorrection(txt) : &#10;  &#10;  b = TextBlob(txt)&#10;  return b.correct()&#10;&#10;&#10;def rm_main(data):&#10;&#10;&#10;  data['corrected_text'] = data[Text_Attribute].apply(spellingCorrection)&#10;&#10;  return data"/>
      </operator>
      <connect from_op="Search Twitter" from_port="output" to_op="Select Attributes" to_port="example set input"/>
      <connect from_op="Select Attributes" from_port="example set output" to_op="Nominal to Text" to_port="example set input"/>
      <connect from_op="Nominal to Text" from_port="example set output" to_op="Process Documents from Data" to_port="example set"/>
      <connect from_op="Process Documents from Data" from_port="example set" to_op="Set Text Atribute" to_port="through 1"/>
      <connect from_op="Set Text Atribute" from_port="through 1" to_op="Execute Python" to_port="input 1"/>
      <connect from_op="Execute Python" 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>

Note that according to the number of tweets, the correction of the tweets may take many minutes.

 

Regards,

 

Lionel

 

Unicorn
Unicorn

Re: How to correct the wrong words?

@lionelderkrikor this is quite handy, thank you for this!

Regards,
Thomas

Blog: Neural Market Trends

RapidMiner Tutorial Videos here!
Highlighted

Re: How to correct the wrong words?

Hi,

 

You're welcome, @Thomas_Ott.

 

Happy corrections !

 

Regards,

 

Lionel

Contributor II jozeftomas_2020
Contributor II

Re: How to correct the wrong words?

Hello
Thank you so much
Really your codes will surprise me
I do not know how to thank
But the master
In one comment, I typed a false word and run the program. As a result, the word was not corrected
Maybe check
like this
iphon worst phone appl made helo meseg
After running
iphon worst phone appl made helo meseg
I wanted to correct the two words helo, meseg as hello, message
Thank you