Text functions in the Factory

Text functions perform operations on text, such as extracting part of it, removing the start/end of a word.

They can also be used with the other attribute types, as they cast the value to nominal upon function’s computation.

If you are using any of these functions with continuous attributes, please double check the Flow Execution Parameters, as you can set the number of digits to be displayed after the function’s computation.

Rulex Platform formula

Function

Formula

Description

charReplace

charReplace(column, oldchar, newchar, unchanged, charforothers, considersequence)

Replaces the current fonts with new ones.

distance

distance(column1, column2, method)

Computes the distance between the values of two columns, column1, column2, according to one of the following methods: "levenshtein" ("I"), "damerau-levenshtein" ("dl"), "lcs", "hamming".

find

find(column, value, binary, ischarlist, charpos)

Looks for a value in a column and returns True or False.

head

head(column, nchar)

Returns in each row of the result with the first n letters of the corresponding value contained in the column.

isPrefix

isPrefix(column, value, binary)

Checks whether a string is a prefix or not.

isSuffix

isSuffix(column, value, binary)

Checks whether a string is a suffix or not.

isWord

isWord(column, substring, delimiter, binary)

Checks whether a string (which can have a delimiter) is contained in an attribute or not.

numExt

numExt(column, onlyint, separator)

Returns a string containing only the numerical fonts of the input string. If more than one number is present, numbers are delimited by a separator decided by the user (by default "-").

pad

pad(column, len, value, where)

Returns in each row of the result, the values of the column, filled (padded) with the padstring value to reach the specified length. The string can be added at the beginning (where = "begin" or by default) or at the end (where = "end") of the string, according to the value of the parameter where.

phonetic

phonetic(column, component)

Returns the phonetic encoding of the strings contained in the column using the Metaphone algorithm. Phonetic may return the primary Metaphone component (component = "Primary" or component = "P") or the secondary component (component = "Secondary" or component = "S"). By default the primary component is returned.

prefix

prefix(column, value, last)

Considers the chosen value as prefix and returns the subsequent fonts.

replace

replace(column, oldvalue, newvalue, ntimes)

Replaces the current strings of the values in the column with the new ones.

strip

strip(column, value, where, ischarlist)

Returns the value without the specified characters or list of characters located at the beginning, at the end or on both sides of the value.

suffix

suffix(column, value, last)

Considers the chosen value as suffix and returns the preceding characters.

tail

tail(column, nchar)

Returns the last n letters of the corresponding value in the column.

textConcat

textConcat(column, separator, group)

Returns the concatenation of all the strings in a column.

textExtract

textExtract(column, startpos, endpos)

Returns the string ranging from a defined starting position to defined ending position.

textFormat

textFormat(column)

Returns the type of the strings in each row of the column.

textLen

textLen(column)

Returns the length of the string contained in each row of the column.

textLower

textLower(column, mode, leaveother)

Changes uppercase fonts of a nominal attribute to lowercase fonts.

textSort

textSort(column, ascending)

Sorts in ascending order the strings contained in each cell of a nominal attribute.

textUpper

textUpper(column, mode, leaveother)

Changes lowercase fonts of a nominal attribute to uppercase fonts.

Parameters in bold are mandatory.