Tinderbox v9 Icon

wordsRelatedTo(dataStr[, wordsNum])

Operator Type: 

Operator Scope of Action: 

Operator Purpose: 

Operator First Added: 

Operator Last Altered: 

Operator Has Optional Arguments: 

 Function  [other Function type actions]

 Item  [operators of similar scope]

 Data manipulation  [other Data manipulation operators]


 As at baseline

 [More on optional operator arguments]

wordsRelatedTo(dataStr[, wordsNum])

NOTE: This feature needs macOS 10.15.0 or later. If used on older OSs, the function returns no data; i.e. not all users of v8.x maybe able to use this feature as it is macOS version dependent.

The operator tries to return a list (Set) of up to wordsNum (discrete) words related to its dataStr argument. Fewer words may be returned, or no words may be returned if the argument is unusual, or if the current language is not supported.

An optional second argument wordsNum, allows the returned number of related terms to be limited to a specific number of items. wordsNum is 1 or more (integer value), but Tinderbox will only return as many 'related' terms as it can find, i.e. it may return fewer than wordsNum items.

Practically, an wordsNum value of more than 10 items is unlikely to render useful results. Be aware this draws on features still under development in the underlying OS, so there are no certainties.

$MySet = wordsRelatedTo("hubris"); 

or to get only 5 (or fewer) values:

$MySet = wordsRelatedTo("aspirational",5); 

It is not certain, but likely, that results returned are are ordered by proximity of the relationship in the vector space of the dataStr (bear in mind this is a black-box OS procedure).

Though the product is essentially a Set, i.e. a list without duplicates, Sets may change the order of items during other processes whilst List attributes do not. So if concerned about retaining order exactly as originally returned by the function, it makes would pass the process to an explicit list

$MyList = wordsRelatedTo("expectation",8);