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

Using dash in sentence
 
 

I want to enter the name of some subway stations like:

42 St - Times Square

However, the input get separated into two sentences, 42 St and Times Square. Is there a way to process them together?

Thanks!

 

 
  [ # 1 ]

add to your bot definition:

$cs_token ^= #NO_HYPHEN_END

 

 
  [ # 2 ]

Hi Bruce,

I tried something like this:

$cs_token = #DO_INTERJECTION_SPLITTING | #DO_SUBSTITUTE_SYSTEM   | #DO_NUMBER_MERGE | #DO_DATE_MERGE | #DO_PROPERNAME_MERGE | #DO_SPELLCHECK | #DO_PARSE
$cs_token ^= #NO_HYPHEN_END

However, when i test in :prepare, it didn’t work as expected. I get the following in the output

After parse TokenFlags: DO_ESSENTIALS HYPHEN_END PRESENT PERIODMARK USERINPUT FAULTY_PARSE NOT_SENTENCE
TokenControl: DO_SUBSTITUTE_SYSTEM DO_NUMBER_MERGE DO_PROPERNAME_MERGE DO_DATE_MERGE DO_SPELLCHECK DO_INTERJECTION_SPLITTING DO_PARSE

 

 
  [ # 3 ]

hi Michael, please show your source code/rule to catch:

42 St - Times Square


1. in control script set:

$cs_token ^= #NO_HYPHEN_END

2. in your application topic,  maybe you can use a pattern like

topic: ~introductions keep repeat []

u: (_* - _*)
  1. street: ^original(_0) \n
  2. district: ^original(_1)


producing this output:

>>  42 St - Times Square
1. street: 42 St
2. district: Times Square

 

 
  [ # 4 ]

Hi Giorgio,

Thanks for the info. I tried the rules you wrote and it didn’t match.

The :prepare output I get is below. Seems it is still using HYPHEN_END instead of NO_HYPHEN_END.

Original User Input42 St Times Square
Tokenized into
42  St  .  
Substituted (essentials into42  St  
Actual used input
42 St 

Xref
1:42   2:St   
1
:42   2:St   
badparse Tagged POS 2 words
42 (MAINSUBJECT Noun_number)  St (MAINOBJECT Noun_proper_singular)  
  
MainSentenceSubj42  PRESENT 


Concepts


142 (raw):  +~noun +~noun_number +~train_station_ids +~train_station_name +T~subway_flow  +~noun_bits
 
+~mainsubject +~number +42 // 
142 (canonical):  //  +~integer +~positiveInteger 

2St (raw):  +~noun_title_of_address +~noun +~noun_proper_singular +~singular +~normal_noun_bits
 
+~noun_bits +~mainobject +~sentenceend //  +St +~train_station_suffix
2St (canonical):  //   +~propername

Sequences:
After parse TokenFlagsDO_ESSENTIALS HYPHEN_END PRESENT PERIODMARK USERINPUT FAULTY_PARSE NOT_SENTENCE 
TokenControl
DO_SUBSTITUTE_SYSTEM DO_NUMBER_MERGE DO_PROPERNAME_MERGE DO_DATE_MERGE DO_SPELLCHECK DO_INTERJECTION_SPLITTING DO_PARSE 


Original User Input
Times Square
Tokenized into
Times  Square  
Actual used input
Times_Square(Times Square

Xref1:Times_Square   
1
:Times_Square   
badparse Tagged POS 1 words
Times_Square (MAINSUBJECT Noun_proper_singular)  
  
MainSentenceSubjTimes_Square  PRESENT 


Concepts


1Times_Square (raw):  +~noun_title_of_work +~noun +~noun_proper_singular +~singular +~normal_noun_bits
 
+~noun_bits +~mainsubject +~sentenceend //  +Times_Square +Times_Square~1 +city_district~1 +district~1 +region~4 +location~1
 
+~train_station_name +T~subway_flow  +object~+physical_entity~+entity~+~nounroot
1
Times_Square (canonical):  //   +Square +~train_station_suffix +~propername

Sequences:
After parse TokenFlagsPROPERNAME_MERGE PRESENT USERINPUT FAULTY_PARSE NOT_SENTENCE 
 

 
  [ # 5 ]

Michael,

I verified the code chunk I submitted ad it works fine; you need to modify the cs_token, putting

$cs_token ^= #NO_HYPHEN_END

before the rule fire,
e.g. in the control script (simplecontrol.top in case of HARRY demo bot):

$cs_token = #DO_INTERJECTION_SPLITTING | #DO_SUBSTITUTE_SYSTEM   | #DO_NUMBER_MERGE | #DO_DATE_MERGE | #DO_PROPERNAME_MERGE | #DO_SPELLCHECK | #DO_PARSE

$cs_token ^= #NO_HYPHEN_END

 

 
  [ # 6 ]

I moved the $cs_token ^= #NO_HYPHEN_END and it works now. It didn’t work in the first place. How mysterious!

Thanks for the help!

 

 
  [ # 7 ]

probably because when you change code in the bot macro, it does not have any effect except on NEW users or if you reset the existing user.

 

 
  login or register to react