Tinderbox v8 Icon

wordsRelatedTo("term"[,N])


Operator Type: 

Operator Scope of Action: 

Operator Purpose: 

Operator First Added: 

Operator Altered: 

 Function   [other Function type actions]

 Item   [operators of similar scope]

 Data manipulation   [other Data manipulation operators]

 8.8.0

 


wordsRelatedTo("term"[, N])

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 N (discrete) words related to its term argument. Fewer words may be returned, or no words may be returned if the argument is unusual, or if the current language isn't supported.

An optional second parameter N, allows the returned number of related terms to be limited to a specific number of items. N 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 N items.

Practically, an N 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 term (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);