AI Zone Admin Forum Add your forum

NEWS: Chatbots.org survey on 3000 US and UK consumers shows it is time for chatbot integration in customer service!read more..

^pick() from a large concept doesn’t appear very random
 
 

I’d like to generate a pseudo-random string that is derived from English words, as opposed to just a sequence of random characters. It doesn’t need to be guaranteed unique, just “random enough”.

I’ve written an output macro that does this using ^pick(~adjectivelist), ^pick(~nounlist), and %rand, which produces strings like the following:

Kneeling-teflon-65
Similar
-edibility-7
Obligatory
-mileage-31 

This is exactly what I’m looking for, but I’ve noticed that ^pick() is returning the same words a lot of the time, despite using very large concepts as the input (adjectives and nouns).

When I ran the output macro 50-odd times, the adjectives “criminal”, “similar”, and “snowy” showed up in almost half of the outputs.

Criminal-spell-51              <-- Criminal 
Similar
-force-8                <-- Similar     
Mild
-milk-50
Similar
-week-50                <-- Similar     
Severe
-size-50
Visible
-erosion-72
Criminal
-fluid-72              <-- Criminal 
Snowy
-width-96                 <-- Snowy                 
Quick
-freeze-92
Obligatory
-mileage-31
Dizzy
-mileage-31
Charming
-plasma-82
Criminal
-erosion-5             <-- Criminal   
Similar
-edibility-7            <-- Similar         
Heavy
-sexennial-28
Beautiful
-force-73
Silky
-hot-25
Snowy
-minute-95                <-- Snowy                 
Past
-hexing-44
Catholic
-polypropylene-3
Criminal
-hexing-44             <-- Criminal   
Similar
-chill-26               <-- Similar       
Heavy
-diurnal-58
Obligatory
-flame-64
Soft
-hypergiant-62
Snowy
-charm-97                 <-- Snowy                 
Current
-twinight-62
Similar
-twinight-62            <-- Similar         
Severe
-health-62
Materialistic
-draft-5
Criminal
-grill-5               <-- Criminal 
Snowy
-color-5                  <-- Snowy               
Rapid
-plague-90
Rational
-morning-72
Kneeling
-teflon-65
Capable
-erosion-65
Undersized
-height-83
Snowy
-spring-47                <-- Snowy                 
Past
-erosion-47
Resourceful
-clientele-80
Criminal
-erosion-47            <-- Criminal   
Similar
-clientele-80           <-- Similar           
Outright
-spark-10
Snowy
-ulcer-51                 <-- Snowy                 
Impulsive
-force-80
Difficult
-liquid-42
Enabled
-reputation-19
Similar
-hour-19                <-- Similar     
Severe
-reputation-19
Invisible
-snorkeler-10
Criminal
-draft-1               <-- Criminal 
Similar
-second-10              <-- Similar 

My output macro is as follows:

outputmacro: ^humanReadableRandomName()
 $
$_adjective = ^pick(~adjectivelist)
 $
$_noun = ^pick(~nounlist)
 $
$_num = %rand
 
$$_result = ^eval($$_adjective $$_noun $$_num)
 
$$_result = ^removeSpaces($$_result)
 $
$_result = ^removeUnderscores($$_result)
 $
$_result = ^pos(LOWERCASE $$_result)
 $
$_result 
 

 
  [ # 1 ]

After looking at the structure of ~adjectivelist, it’s clear why certain words are coming up more than others. The frequently-occurring words appear very high up in the tree, and belong to concepts where there are only a few words (e.g. “criminal” is the only word in ~relational_adjectives, which is a direct child of ~adjectivelist).

So, it appears that I need a ‘flatter’ concept from which to ^pick(). Is there a way to flatten a concept? I don’t imagine this would be a quick operation, so I could do it once and store the result in a new ~flatadjectivelist concept if required.

Unless there’s a better way to achieve what I’m doing?

 

 
  [ # 2 ]

I used :allmembers ~adjectivelist to flatten the concept, then copied the words into my own concept ~flatadjectivelist. Did the same with the nouns. Works well now.

Still interested in any other/better ways if anyone has any.

 

 
  [ # 3 ]

that’s a fine way. 

CS does not try to flatten it on the fly as that would be potentially expensive in CPU and memory. So it walks the top level, randomly picking a member. If that turns out to be a concept, it then walks that set and randomly picks that member and so on.

 

 
  [ # 4 ]

Inspired by Rohan Listons macro I build a pet name, nickname Generator.

I tried a concept with all possible pet names (22000) in alphabetical order.

I tried ^pick(~petname) many times but got only names starting with letter A or letter B.

In the concept ~petname Names with Letter C start at position 3406. ^pick() In seems to work fine with smaller concepts

Maybe ^pick is not working randomly on very large concepts. Any ideas are appreciated.

 

 
  login or register to react