AI Zone Admin Forum Add your forum

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

Using of an external pos-tagger

I tried to use an external ps-tagger as german example. This is the script:

outputmacro: ^myfunc(^data) ($$concept)
$$wordindex += 1   # count words in each sentence
_0 = ^burst(^data ^”\t”) # Treetagger returns a tabbed triple of original word, tag, lemma
$$concept = ^join(~ _1)  # we turn tag into a concept
^settag($$wordindex $$concept ) # set the tag concept
^setcanon($$wordindex _2 ) # set the canonical form to ChatScript

topic: ~xPOSTAGSENTENCE system()
t: (_* )  # memorize sentence to pass to tagger
t: ( )
$$wordindex = 0   # need to start over for each sentence, used to locate word in sentence
^log(FILE chat.txt NEW ‘_0 ) # non-commercial version reads a file, so write our sentence to a file
  ^popen(“python @CMAKE_INSTALL_PREFIX@/ chat.txt” ‘^myfunc) # invoke local copy of Lima

topic: ~introductions keep repeat ()

The problem is that the ~ xPOSTAGSENTENCE function runs only at system startup. Once after the first interaction, this function does not run anymore, the popen function does not run any more. Can someone understand why? can the process of using an external postagger?



  login or register to react