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
Text manipulation
I have the following word after some concatenation:
HYDROCHLOROTHIAZIDE|NIFEDIPINE These are two words HYDROCHLOROTHIAZIDE and NIFEDIPINE with a "|" symbol in between. Can this be manipulated to read HYDROCHLOROTHIAZIDE and NIFEDIPINE, i.e. putting spaces and replacing "|" with "and"? Thank you in advance. |
Tagged:
0
Best Answer
-
IngoRM Employee-RapidMiner, RapidMiner Certified Analyst, RapidMiner Certified Expert, Community Manager, RMResearcher, Member, University Professor Posts: 1,751 RM FounderHi,Sure, you can use the operator Replace for that (or do this in Turbo Prep quite easily in Transform --> Replace). I have attached a small example process below. Keep in mind though that the operator uses regular expressions and the symbol "|" has a special meaning. You therefore need to quote the pipe symbol with a backslash like this "\|" and simply use " and " as the replacement value. Just see the process and you will see what I mean...Hope this helps,
Ingo<?xml version="1.0" encoding="UTF-8"?><process version="9.3.000-SNAPSHOT"><br> <context><br> <input/><br> <output/><br> <macros/><br> </context><br> <operator activated="true" class="process" compatibility="9.3.000-SNAPSHOT" expanded="true" name="Process"><br> <parameter key="logverbosity" value="init"/><br> <parameter key="random_seed" value="2001"/><br> <parameter key="send_mail" value="never"/><br> <parameter key="notification_email" value=""/><br> <parameter key="process_duration_for_mail" value="30"/><br> <parameter key="encoding" value="UTF-8"/><br> <process expanded="true"><br> <operator activated="true" class="utility:create_exampleset" compatibility="9.3.000-SNAPSHOT" expanded="true" height="68" name="Create ExampleSet" width="90" x="45" y="34"><br> <parameter key="generator_type" value="comma separated text"/><br> <parameter key="number_of_examples" value="100"/><br> <parameter key="use_stepsize" value="false"/><br> <list key="function_descriptions"/><br> <parameter key="add_id_attribute" value="false"/><br> <list key="numeric_series_configuration"/><br> <list key="date_series_configuration"/><br> <list key="date_series_configuration (interval)"/><br> <parameter key="date_format" value="yyyy-MM-dd HH:mm:ss"/><br> <parameter key="time_zone" value="SYSTEM"/><br> <parameter key="input_csv_text" value="Text HYDROCHLOROTHIAZIDE|NIFEDIPINE"/><br> <parameter key="column_separator" value=","/><br> <parameter key="parse_all_as_nominal" value="false"/><br> <parameter key="decimal_point_character" value="."/><br> <parameter key="trim_attribute_names" value="true"/><br> </operator><br> <operator activated="true" class="replace" compatibility="9.3.000-SNAPSHOT" expanded="true" height="82" name="Replace" width="90" x="179" y="34"><br> <parameter key="attribute_filter_type" value="single"/><br> <parameter key="attribute" value="Text"/><br> <parameter key="attributes" value=""/><br> <parameter key="use_except_expression" value="false"/><br> <parameter key="value_type" value="nominal"/><br> <parameter key="use_value_type_exception" value="false"/><br> <parameter key="except_value_type" value="file_path"/><br> <parameter key="block_type" value="single_value"/><br> <parameter key="use_block_type_exception" value="false"/><br> <parameter key="except_block_type" value="single_value"/><br> <parameter key="invert_selection" value="false"/><br> <parameter key="include_special_attributes" value="false"/><br> <parameter key="replace_what" value="\|"/><br> <parameter key="replace_by" value=" and "/><br> </operator><br> <connect from_op="Create ExampleSet" from_port="output" to_op="Replace" to_port="example set input"/><br> <connect from_op="Replace" from_port="example set output" to_port="result 1"/><br> <portSpacing port="source_input 1" spacing="0"/><br> <portSpacing port="sink_result 1" spacing="0"/><br> <portSpacing port="sink_result 2" spacing="0"/><br> </process><br> </operator><br></process>
6
Answers
Regards.
Chris