The Altair Community is migrating to a new platform to provide a better experience for you. In preparation for the migration, the Altair Community is on read-only mode from October 28 - November 6, 2024. Technical support via cases will continue to work as is. For any urgent requests from Students/Faculty members, please submit the form linked here

Reverse of word list: how to generate a text attribute by repeating a value?

die_eikedie_eike Member Posts: 10 Contributor II
edited November 2019 in Help
Hello Community,

what I am trying to do is somehow the reverse of the aggregate operator or the word list. I have an example set (document) with a nominal attribute (word) and a numerical attribute (frequency=n). I want to generate a new text attribute with the word repeated n times, separated by space.

I can't find an operator to do this. I tried generate attributes, but I can't find a mathematical expression for what I want to do. As it seems to me rather simple a process, I hope I did not miss anything posted in the community already. I searched but I couldn't find anything.

Anybody who can help me?

Best Answers

Answers

  • Telcontar120Telcontar120 RapidMiner Certified Analyst, RapidMiner Certified Expert, Member Posts: 1,635 Unicorn
    Perhaps you could provide a pre and post-output sample dataset?  I am not quite envisioning exactly what you want to produce here or the exact format of your original data.
    Brian T.
    Lindon Ventures 
    Data Science Consulting from Certified RapidMiner Experts
  • rfuentealbarfuentealba RapidMiner Certified Analyst, Member, University Professor Posts: 568 Unicorn
    Let me understand:

    You have this dataset (word and freq) and want the "generated" attribute?:

    na na na na <code>na na na na na na na na word | freq | generated<br>--------------------------------------------------------------<br>a    | 5    | a a a a a<br>ze   | 3    | ze ze ze<br>nini | 2    | nini nini nini<br>na   | 16   | na na na na 

    Do you want it with or without spaces?

    All the best,

    Rod.
  • Telcontar120Telcontar120 RapidMiner Certified Analyst, RapidMiner Certified Expert, Member Posts: 1,635 Unicorn
    Wow, these other unicorns have already solved the problem!  That was fast, great work guys!
    Brian T.
    Lindon Ventures 
    Data Science Consulting from Certified RapidMiner Experts
  • die_eikedie_eike Member Posts: 10 Contributor II
    Dear Unicorns,

    thanks for your help!

    @rfuentealba, this is exactly what I wanted.

    @BalazsBarany, thanks for the process and the detailed description. I will try it out for my data now and report if it has done the trick for me.

    Just one question beforehand, would it make sense to have an operator in Rapidminer which performs such an operation? I don't know, but it could be useful in several cases to have an operator which repeats the (nominal or other) values of an attribute with a given frequency (constant, or indicated by a value in another attribute).

    Best,
    Eike

  • die_eikedie_eike Member Posts: 10 Contributor II

    your process is giving me a "Required parameter missing" and indeed you did not specify the function description in the lower "Create Example Set". I am a bit at a loss here. Could you help me out?

    Best,

    Eike

    P.S.: Sorry for my earlier question, you just said it here and I overlooked it:
    "This would be much easier if we had a simple "repeat" function in Generate Attributes."





  • BalazsBaranyBalazsBarany Administrator, Moderator, Employee-RapidMiner, RapidMiner Certified Analyst, RapidMiner Certified Expert Posts: 955 Unicorn
    Hi,

    I was in an older Studio and there it worked.
    You can add a dummy function in "Edit List...": attribute name = x, function expressions = 1.

    Regards,

    Balázs
  • die_eikedie_eike Member Posts: 10 Contributor II
    Hello @BalazsBarany and others,

    sorry for the late replay. I had to work on another project last couple of days and to delay this one. Your process works now and I was able to adjust it for my data :smile: 

    Thanks a lot!
Sign In or Register to comment.