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

Handling possessives using apostrophe s
 
 

Bruce,

I would like to strip out certain phrases such as prepositional phrases and simplify the users input and then send it back to have chatscript try to parse the sentence again.

Here is a simplified example pattern:

u: ( ~preposition ) refine() ^keep ^repeat
a: ( < _* _~preposition _~determiner _~noun _* > )
      ^input( ^join( AUTOSPACE ‘_0 ‘_4)) ^fail(SENTENCE)
a: ( < _* _~preposition _~noun _* > )
      ^input( ^join( AUTOSPACE ‘_0 ‘_3 )) ^fail(SENTENCE)

#1) I have an issue with possessive words that include an apostrophe.  In the sample:

The people’s desire for justice was rising.

Chatscript separates people from the ‘s with a space: The people ‘s desire for justice was rising.

That is fine, but when it is captured and resubmitted as input then Chatscript converts the ‘s to the word “is”.  I cannot find a substitution or where to resolve this.  I would prefer it kept the ‘s the same.

The prepare command shows this in the output indicating it happens in the tokenizing step:

Original User Input: The people ‘s desire for justice was rising
Tokenized into: The people is desire for justice was rising
merged: the people is desire for justice was rising
Actual used input: the people is desire for justice was rising

#2) I had to use the < > in the patterns so that the first and last variables captured all of the text from the beginning of the sentence to the position of the preposition and from the end of the prepositional phrase to the end of the sentence.  Otherwise, only a few words before the match were captured in the ‘_0 variable and sent back to ^input for reprocessing.  Is this correct?

Thanks.

(PS. The POS tagger is great.  Do not give up on it.  My wish list includes: exposed tags linking phrases to mainsubject, mainverb, and maindirect and mainindirect, etc.)

 

 
  [ # 1 ]

You could join your input, then ^substitute(character $$tmp ” ‘s”  “‘s”)  to remove the space.

you do not need < or > in your patterns.

You have no reason to put _ in front of the preposition determiner noun stuff, since you dont use it.

You could merge this all into one rule as:

u: (_* ~preposition {~determiner} ~noun _*)

 

 
  [ # 2 ]

apostrophe fixed in ^input

 

 
  [ # 3 ]

Great!  Thanks!

Since this seems to be the week for questions and while we are discussing possessives:

The PosParser.pdf document shows that ~determiner_bits contains ~pronoun_possesive but typing :down ~determiner_bits shows: ~predeterminer ~determiner ~predeterminer ~determiner

:down ~verb shows nothing
:down ~verbs works and lists members
:down ~noun shows nothing
:down ~nouns shows nothing
:down ~pronoun shows nothing
:down ~pronoun_possessive shows nothing

I was going to ask if there was a way to drill down into the parts of speech.  We should be able to type :down ~pos and see what is currently available and then I thought I should try that before I asked and it worked beautifully!

I see that typing :down ~possessive_bits shows:
~pronoun_possessive ~possessive ~pronoun_possessive ~possessive

but :down ~pronoun_possessive still shows nothing and
:down ~possessive still shows nothing


I’m on version 5.31. Are the possessive concepts being reworked? 

 

 
  [ # 4 ]

:down only works on predefined enumerated values, including the ontology concepts, topics, and wordnet.
Things like ~number and the parser values ~verb etc are all computed dynamically by the engine and hence they will not display anything useful.

 

 
  login or register to react