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..

Converting word forms
 
 

Is there any way to convert a word found in input to some of its various forms? Like tenses, nouns, adjective, verbs? I’m thinking this might be useful for building a fact database for conversations.

 

 
  [ # 1 ]

depends.  the function is ^pos

 

 
  [ # 2 ]

^pos can tell me the type of the word. Like is it a noun or verb. I’m wondering if there is any way to convert that word to the other relevant type.
E.g. if i input verb sing it will return singer or song and vice versa
  or if I input ate it will return the ~food concept

pos(verb ate match) returns eats which sort of works as both noun/verb but
pos(verb sang match) returns sangs which i dont even think is a word

 

 
  [ # 3 ]

I’m pretty certain from reading the docs that the above idea would involve create of some major db.

As a side note, is there any function that returns the word at a given index of a string? Like index 2 of “I am here” would be “am”. I want to use this with ^burst(wordcount..) to parse a string if there is no other way.

 

 
  [ # 4 ]

re bursting—-  so, you can burst a string based on spaces into facts. You can query to get those facts, then retrieve facts from a factset.

 

 
  [ # 5 ]

^POS has a number of options. It can conjugate a verb. it can get singular/plural of nouns, comparatives of adverbs and adjectives. But there is no crossover from one word form to another, NOT from sing to singer.

 

 
  [ # 6 ]

Is there any way to save facts automatically into user data so that I can see them? I tried putting save(@1) into simplecontrol.top and the user file does show a section for user facts but it only has (converse defaultbot defaultbot) listed , not the facts from my burst. Is this because factsets are transient? Do I have to use makereal or somesuch?

 

 
  [ # 7 ]

burst facts are created transient. When you query them into a factset, Yes, you can then ^makereal on that.

 

 
  [ # 8 ]

Can I also copy the transient facts to another set to make them permanent?
Like ^save(@2)
    @1fact=burst(_0 ” “)
    @2fact=@1fact

This gives me an error on the first line saying save has incorrect number of arguments.

 

 
  [ # 9 ]

save requires a second arg that says to turn on or off the property

@2 = @1   should also be sufficient for assignment

 

 
  [ # 10 ]

Thanks Bruce. But the Facts Manual just defines the syntax for save as ^save(set).
I have the following code which runs fine with the input: test a b c
but does not show any facts in userdata. Can you show me where I’m going wrong?

u: (test _*)  ^keep() ^repeat() ^save(@2 on)
  @1fact= ^burst(_0 ” “)
  @2=@1
  ^reset(@1)
  loop()  {
$word = ^next(FACT @1subject)
if ($word != null) {Say $word}
  }

 

 
  [ # 11 ]

several things.

1:  @1 = ^burst(‘_0 ” “)
there is no use for fact on the @1, the burst needs normal quotes not inverted quotation directions
2: a callous disregard for spaces between different tokens   @2 =  @1
3: Probably want to quote _0 in the burst.

 

 
  [ # 12 ]
Bruce Wilcox - Mar 28, 2015:

several things.

1:  @1 = ^burst(‘_0 ” “)
there is no use for fact on the @1, the burst needs normal quotes not inverted quotation directions
2: a callous disregard for spaces between different tokens   @2 =  @1
3: Probably want to quote _0 in the burst.

Thanks Bruce, spacing the set tokens fixed my problem. I was not aware of this issue and it will be good to keep an eye out for this with other code.

I am not sure what you mean by inverted quotes. In my top file I have normal quotes but they become inverted when posting on the board.

Is there any way to store created facts to a specific group to delete as a batch later? Say I want to create facts for a specific topic and this topic will have regular facts as well as facts of facts. Is that only possible by storing topic info in the fact itself?

 

 

 
  [ # 13 ]

not sure what you want. You create facts for a topic. and facts of facts. What facts did you want to delete? if you delete the fact referred to by another fact, that other fact should also die. Normally the way to delete a batch of facts is to query them into a factset and delete that.

 

 
  [ # 14 ]

Say I have the following facts. I have no experience with facts and have only read the facts manual so these may be stupid questions:

(converse movies actors)
( (converse movies actors) female names )
( ( (converse movies actors) female names ) surname Anderson)
( ( ( (converse movies actors) female names ) surname Anderson) firstname Pamela)
( ( ( (converse movies actors) female names ) surname Anderson) firstname Judith)

- Can query(direct_svo ..first fact..) then delete(@0) delete all these facts from user or only from @0?
- I realize the default number for facts is 1000 but where and how do I change that value?
- A huge number of facts will take up a lot of memory I’m sure but is it disk or ram? Can it be only disk?

 

 
  [ # 15 ]

If you want to merely empty a factset, you do   @0 = null which does not damage any facts.
When you do ^delete(@) you delete all facts within that factset.
When the system saves user data at the end of a volley, it saves all non-transient, non-dead facts of the user. It also saves all contents of facts that are marked to save that are not dead.  It will save transient facts because they are referenced by the factset.
If a fact is needed (nested) inside some other fact and that base fact is deleted, then the outer fact will not be saved as part of saving all user facts.

the default value is a command line parameter

facts take up disk and ram.
There is no way that facts take up only disk.  If you want disk only stuff, you need to store data in Postgres and retrieve it via script.

 

 1 2 > 
1 of 2
 
  login or register to react