How do you make new a column from keyword?

72 Views Asked by At

Beginner's question: I have a column with free text sentences, and I'm trying to draw a particular keyword out of this column and create a new column out of that particular keyword. How would I go about doing that? A GREL command?

1

There are 1 best solutions below

4
b2m On

As usual there are several options for this.

Facets & Filtering

  1. You could use a Word facet or Text filter to filter rows containing your keyword.
  2. Then with the filter in place add a new column and enter the string "YourKeyword" (or whatever text you like) as value for the new column.

GREL

  1. Add a new column based on the column that contains the free text sentences.
  2. Use either value.find("YourKeyword")[0] or value.contains("YourKeyword") as GREL expression.

Note that find will directly place the found keyword into the new column, whereas contains will add a boolean marker (true or false) indicating whether the keyword is present or not.

Beware that you might have to tweak the keyword searching based on the properties of your free text to avoid matching substrings. Meaning that "soft" will also match "software". Depending on your keyword and text properties you might want to have a look into regular expressions. Regular expressions are supported in the mentioned GREL functions and in the above mentioned text filter.