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

Multiple conditions in a pattern
 
 

Hi all,

I’m interested in doing something like this:

a: (_1?~noun)

if ($tags_level >= 0) {
^createfact(^join(user__ _1) is_a noun)
}

b: ($tags_level >= 1 _1?~noun_singular)
    ^createfact(^join(user__ _1) is_a noun_singular)
b: ($tags_level >= 1 _1?~noun_plural)
    ^createfact(^join(user__ _1) is_a noun_plural)

The goal is to save some of the POS tags and other semantic tags in user facts for later use.
But, I want to be able to control the semantic \ grammatical deepness as in the example above.

So, the first question is technically, how to write multiple conditions to determine if the rule fail or not. I don’t seems to be able to find a correct way of doing so.

The second is more theoretically, what’s the best way to divide the tags into levels, so for example, tags such as:
level 0: basic pos tags (noun, proper noun)
level 1: more specific pos categories (plural, singular)
level 2: sentence structure tags (subject, object)
level x: attributes such as: ~tool…
level y: attributes such as: ~enterable \ ~immovable
and so on.

I’m looking for a simple way to determine this, maybe wordnet has some tricks for it or the ChatScript mechanism already works with some groups of marks / tags I can use.

Thanks in advance,

Sam

 

 
  [ # 1 ]

well, not sure what your _1 in first rule comes from.
u: (_~noun)  would get you the first noun.

your b:  cannot have spaces in a comparison so must be $tags_level>=1   as a single token but could have been this
  b: ($tags_level>=1) refine()
    c: (_1?~noun_singular)  createfact
    c: (_1?~noun_plural) createfact

to do levels you could do variations of this:
u: (_*1) refine()
  a: (_0?~noun)  save a noun fact
    b: (_0?~noun_singular) save singular
    b: ...plural
  a: (_0?~verb)  save a verb fact
....

and another time not for part of speech but for things like phrases or mainsubject or whatever

 

 
  [ # 2 ]

So I understand it is not possible to enter multiple conditions in the same rule.

Another question about this pattern:
a: (_0?~verb)

how to do negative conditions (not member of verb)?

Thanks

 

 
  [ # 3 ]

I’m not sure what you mean… multiple conditions in the same rule are possible and common. give me an example of what you want to do.

as fo negation, it is
a: (_0!?~verb)
or
a: (!_0?~verb)

 

 
  [ # 4 ]

In general, I need a way to check for membership of input in a concept only if some variable holds specific value or is les than or greater than some value.

Another example of multiple conditions,
Assuming I want to distinguish between common noun and proper noun:

# noun AND not proper noun
a: (_0?~noun *AND* _0!?~noun_proper_singular)  # accepts *city* or *cities* but not *london*

# noun AND not proper noun
a: (_0?~noun_singular *OR* _0?~noun_plural)  # accepts *city* or *cities* but not *london*

I’m not sure how to implement OR and AND operators. I’m looking for the right way to extract information about the input.

In addition, is this way:
a: (_0?~noun)

Better than this way:
$input = _0
a: ($input?~noun)

in terms of performance?

So in summary, I think I need a reference to a list of conditional operations on concepts and input and some examples.

Thank you very much,

Sam

 

 
  [ # 5 ]

u:( $myvar<5 _~noun)  check for noun only if $myvar < 5

AND is automatic with multiple conditions…
a: (_0?noun _0!?~noun_proper_singular )
HOWEVER, in this case one does not need the first thing because a noun_singular is both a noun and not a proper noun.
a: (_0?~noun_singular)
OR is done with [ ]
a: ( [_0?~noun_singular _0?~noun_plural])

in terms of performance, there is only expense in assigning to a $var before testing.

and we have
u: ( << _~mainsubject _~mainverb _~mainobject >>)
for capturing a standard sentence in any order.

 

 
  [ # 6 ]

Thanks Bruce for the detailed reply. this example is what I needed.

I was wondering. for marks like ~mainsubject that being assigned to word only because of the context of the word.
When I assign the input to a variables like $word = _0. what is really the content of the variable? A string representing the word or object representing the word in the context it were found in.

This is why I’ve asked about performance difference between ($word?~concept) and (_0?~concept).

Thanks for your patient,

Sam

 

 
  [ # 7 ]

An _variable has both the original and canonical forms and where in the input sentence it was.
When you assign to a $variable, you pick which form (original or canonical) to save and you get that text word, no positional data.  The _variable is just 2 forms of text and an integer index. So in use, it is just the same as using a $var (just text) because you name whether it is the original or the canonical text you are using.  Ergo, storing in a $var before use just slows you down by the $var assignment cost.

 

 
  login or register to react