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
[SOLVED] Splitting a nominal attribute that has no separator
Hello.
I have attributes whose values have the form:
AK234
A112
In other words we have set of a alphabetical characters
followed by a set of digits. The question is: how can I split
the attribute into two attributes each containing either the
alphabetical or numerical characters.
I have attempted to use the Split operator but I seem to be
only able to select either one of the parts but not both.
Is their any way I can do this with an operator?
TIA,
Hugo F.
I have attributes whose values have the form:
AK234
A112
In other words we have set of a alphabetical characters
followed by a set of digits. The question is: how can I split
the attribute into two attributes each containing either the
alphabetical or numerical characters.
I have attempted to use the Split operator but I seem to be
only able to select either one of the parts but not both.
Is their any way I can do this with an operator?
TIA,
Hugo F.
Tagged:
0
Answers
I have just realized that even though the split via regexp
seems to work in the dialogue box that allows testing, the
output does _not_ split the attribute value.
Any help will be appreciated.
TIA
does your attribute have a special role, is it e.g. defined as label or as id? In that case, you have to check the "include_special_attributes" parameter at the Split operator.
Otherwise, please post your regular expression such that we can have a look at it.
Best regards,
Marius
I think I am close to a solution.
My current attempt uses the expression:
[^a-z]+
so a k100 will have the 100 highlighted.
This means I can generate attributes such as:
att_
att_g
att_k
att_l
att_s
etc.
This looks ok. For the second part I have:
[a-z]+
which results in attributes such as:
att_
att_100
att_985
etc.
I cannot seem to do the split in a single expression
(note that I was able to do this when I had values split
with '/' in another attribute). I am now looking how I can
use a "multiply" and then combine those attributes back into
a single example set. Problem is now I have duplicate
attributes.
Seems way too convoluted. Any easier to do this?
TIA
in fact the Split operator is useful, if you have two values in an attribute which are separated by a fixed string. Referring to your example with A100, AK200 or alike, there is no splitting sequence. The case would be different if you had A_100, AK_200 etc. Since you don't have it, you should use Generate Attributes and create 2 new attributes with the following definition:
a1: replaceAll(a, "[a-zA-Z]", "")
a2: replaceAll(a, "[^a-zA-Z]", "")
This assumes that your original attribute is called a. The process below does what I described above.
Best regards,
Marius
Thanks.
Thanks once again.