반응형

스레드(thread)는 어떠한 프로그램 내에서, 특히 프로세스 내에서 실행되는 흐름의 단위를 말한다. 일반적으로 한 프로그램은 하나의 스레드를 가지고 있지만, 프로그램 환경에 따라 둘 이상의 스레드를 동시에 실행할 수 있다. 이러한 실행 방식을 멀티스레드(multithread)라고 한다.


멀티스레딩(multithreading) 컴퓨터는 여러 개의 스레드를 효과적으로 실행할 수 있는 하드웨어 지원을 갖추고 있다. 이는 스레드가 모두 같은 주소 공간에서 동작하여 하나의 CPU 캐시 공유 집합과 하나의 변환 색인 버퍼 (TLB)만 있는 멀티프로세서 시스템 (멀티 코어 시스템)과는 구별한다. 그러므로 멀티스레딩은 프로그램 안에서 병렬 처리의 이점을 맛볼 수 있지만 멀티프로세싱 시스템은 여러 개의 프로그램들을 병렬로 처리할 수 있다. 멀티프로세싱 시스템이 여러 개의 완전한 처리 장치들을 포함하는 반면 멀티스레딩은 스레드 수준뿐 아니라 명령어 수준의 병렬 처리에까지 신경을 쓰면서 하나의 코어에 대한 이용성을 증가하는 것에 초점을 두고 있다.


챗봇에서 웹으로 접속 했을때, 

node.js 로 챗팅 만들었을때와 다르게 바로 멀티쓰레드 진행됨. 

실행한 웹 페이지마다 다른 응답을 보여주었다. 


어떻게 멀티쓰레드가 되는건지원... 


https://github.com/bwilcox-1234/ChatScript/blob/master/SRC/evserver/ev.pod



...

반응형
반응형

[Chatbot] ChatScript 드디어 mac pro에서 구동완료 macOS Sierra 


ChatScript 7.5 버전 사용. 7.52는 에러 발생(2017-08-01 ).


http://127.0.0.1:8888/TESTBOT.php


MAMP 설치해서 웹서비스 구현완료


 * http://exagen.tistory.com/notice/63 를 참고함. 





...

반응형
반응형


-- 2017-08-01


해결함. 

7.52 버전에서 안됐는데, 7.5 버전을 설치하고 

./DICT/*.bin 을 삭제하고 실행하니 잘됨.



thank you.
I did not get version 7.52, but I downloaded it to version 7.5

$ rm -rf ./DICT/*.bin

* .bin Removed and executed.

https://sourceforge.net/projects/chatscript/files/ChatScript-7.5.zip/download



$ ./BINARIES/MacChatScript local

CommandLine:

    local


ChatScript EVSERVER Version 7.43 pid: 2985 64 bit MACH compiled May 30 2017 12:25:23 host=local

Params:   dict:2097151 fact:800000 text:100000kb hash:215127 

          buffer:80x80kb cache:1x5000kb userfacts:100 outputlimit:80000 loglimit:80000

WordNet: dict=200317  fact=85532  heap=13567808 May31'17-15:51:39

Build0:  dict=68208  fact=129260  heap=1150560 Compiled:Jun18'17-12:10:06 by version 7.5 "0"

Build1:  dict=147  fact=15  heap=334988 Compiled:Jun18'17-12:10:22 by version 7.5 "harry"

Used 58MB: dict 268,672 (21493kb) hashdepths 74338.68615.39247.18963.8352.3514.1356.495.164.65.15.1.2.1. words 268672 unusedbuckets 74338 fact 214,807 (10310kb) heap 15053kb

           buffer (6400kb) cache (5000kb)

Free 113MB: dict 1,828,478 fact 585,193 stack/heap 84,946KB 




Enter user name: wani


HARRY:  Welcome to ChatScript.

wani: > hi

HARRY:  Have you been here before?

wani: > no

HARRY:  Then welcome to your first time.

wani: > yes

HARRY:  All right!

wani: > :reset

HARRY:  Welcome to ChatScript.

wani: > 


...



-- 2017-07-28


Mac에서 설치안되서 질문 남김. 


ChatScript 맥프로에서 설치하는데 자꾸 


Bad Binary Dictionary entry, rebuild the binary dictionary member


라고 나옴, 


찾아보니 드디어 며칠만에 나랑 같은 질문한 사람 찾음. 뭔가 이번에 업데이트 되면서 안되는거 같은데, 

질문일시가 2017-07-26. 오! 이 답답함이 나만의 것이 아니었구만. 


윈도우에선 테스트 해봤는데 맥에서 안되니까 환장하겠음,. 시작을 못하니 이거원,


DICT/*.bin 을 삭제하고 해보라길래 삭제하니 binary 오류 표시는 안나는데... 단어 읽고 나서 먹통됨... 바보!

$ ./BINARIES/MacChatScript local

CommandLine: /Users/hongwankim/chatbot/ChatScript-7.52

    local


ChatScript EVSERVER Version 7.5 pid: 27557 64 bit MACH compiled Jun 19 2017 19:23:07 host=local

Params:   dict:2097151 fact:800000 text:100000kb hash:215127 

          buffer:80x80kb cache:1x5000kb userfacts:100 outputlimit:80000 loglimit:80000

read 184223 raw words







그래서, 질문 남겨둠. 과연 이번주에 해결할 수 있을것인가? 


질문글 : https://www.chatbots.org/ai_zone/viewthread/3066/




...

반응형
반응형

[ChatBot] ChatScript 설명.




챗봇 데모 : http://ec2-54-215-197-164.us-west-1.compute.amazonaws.com/speech.php


Github chatscript manual : https://github.com/bwilcox-1234/ChatScript/blob/master/WIKI/ChatScript-Basic-User-Manual.md


ChatScript (CS)는 사용자 텍스트 입력을 받아들이고 텍스트 응답을 생성하도록 설계된 스크립팅 언어입니다.

채팅은 테니스처럼 발리슛으로 진행됩니다 프로그램 은 사용자로부터 하나 이상의 문장 을 입력하고 하나 이상의 문장을 다시 출력합니다.

가장 일반적으로 사용하는 방법은 사용자 가 입력을 받아 응답을 출력하는 프로그램 인 대화 표시 입니다. 그것은 당신과 대화합니다. 그러나 나는 문서 를 읽는 데에만 전념하는 챠트 봇 (chatbot)을 만들었다 이 경우 입력은 전체 문서입니다.

생성되는 출력은 프로그램에 달려 있습니다. 내 프로그램은 목차, 각 장 경계 및 뒤의 색인이있는 위치를 찾도록 설계되었습니다.

그래서, 더 광범위하게, ChatScript는 chatbot을 만드는 것뿐만 아니라 자연어를 조작하기위한 시스템입니다 .

이 문서는 스크립트를 작성하는 방법에 대한 것입니다. 문서에서 Writing a Chatbot 문서에서 봇을 저작하는 것에 대해 생각하는 방법에 대한 좀 더 일반적인 논의 가 있습니다.

반응형
반응형

[ChatScript] ChatScript 에제 따라하기 삽질 중 . 


K-POP 소재로 챗봇 개발하기    다라하는데 오류발생. 삽질 중 . 구글링에도 잘 안나옴. 

그런데, 굉장히 단순한 문제였음. 

 

unknown top-level declaration tablemacro~~~~ 였는데,  구글링에도 답이 없음. 


하다하다 궁극의 코딩 정리를 다시 해보니.

Tablemacro:^NounPlusPP(~~~) 였는데, 

Tablemacro: ^NounPlusPP(~~~) 이렇게 바꾸니 오류 발생 안함. 이건 뭐냐고...?!


그렇게 투애니원의 안부를 chatscript에게 물어볼수 있었다. 









...

반응형
반응형

[ChatScript] ChatScript 에서 Harry를 Dorothy로 바꾸고, 한글인사하기 - 웹으로


로컬에 APM 설치하고, 127.0.0.1/testbot.php 를 실행해보았다. 

그런데, chatscript에 보니까 이미 서버를 구현하는게 있던걸. 이런...



ChatScript port=1024 userlog  이렇게 하면 된다는걸~ 


서버측을 실행히켰는데 어떤 입력도 CMD에선 적용이 안됨. 


"I don't know what to say." 만 난발하고. 


암튼 어떻게 할지 모르다가, 웹 대화창에 입력한데로 챗봇이 실행되는걸 보고 입력창에 빌드명령어 다시 넣고.  빌드 한번 더 해보니 한글 답변을 볼 수 있었음. 


이제 첫번째 콘솔창에서 :build Dorothy reset을 실행하고, 컴파일이 끝나면 수정한 내용을 반영할 수 있도록 CS서버를 새로 기동시킨다. CS서버를 새로 기동시키기 위해서는 웹브라우저의 메시지 창에 :restart를 입력하고 send 함으로써 가능하다.

여기서 메시지 창을 통해 명령어를 전송할 수 있다는 점에 의아해 할 수 있는데, 이는 테스트 하는 동안의 편의를 위한 것이고 테스트가 끝난 후에는 메시지 창을 통한 명령어의 전송을  차단하거나 미리 등록한 사용자만 가능하도록 바꿀 수 있다. 현재는 모두에게 허락되어 있는데 등록한 사용자에게만 가능하도록 하겠다면 다음과 같이 수정하면 된다.

 

l  수정할 파일 : chatscript/authorizedIP.txt

l  현재 내용 : all

l  수정할 내용 : L_t8e3s7t8

 

수정할 내용에는 대문자 L_로 시작하여 뒤에 사용자 이름을 적으면 되는데, 쉽게 추측할 수 없는 사용자 이름을 쓰는 것이 좋을 것이다. 위와 같이 적었다면 브라우저로 로그인하는 ID가 t8e3s7t8일 경우에만 메시지 창의 명령어를 서버에 전송할 수 있다. 이제 다시 돌아와서 시스템이 restart를 하면, 곧이어 :reset 명령을 준다.



반응형
반응형

[ChatScript] ChatScript 에서 Harry를 Dorothy로 바꾸고, 한글인사하기 


참고 : http://exagen.tistory.com/45


맥에선 설치가 안되고, 윈도우에서 잘되네. 이런. ComEmu는 원래 써오던거라 최신으로 업데이트 한번.


참고 글에서의 설명과 달리 버전이 변경되었는지 일단 느낌적으로 해봄. 


/RAWDATA/에 도로시를 Harry 카피해서 만든다. 

그리고, RAWDATA에 filesHarry.txt를 카피해서 filesDorothy.txt를 만든다. 

filesDorothy에서 RAWDATA/QUIBBLE/은 삭제. 삭제권고하셔서 삭제. 근데 build하면 왜 연결안하냐고 경고 나옴. 


CMD에서 >chatscript 실행. 

그리고, 빌드 >:build Dorothy

뭔가 안되서 보니 filesDorothy.txt 에  엉뚱한 내용이 있음. 


#underlying conversation system

RAWDATA/Dorothy/


위의 폴더 경로만 txt 파일에 들어있으면됨. 


다시 빌드하니 도로시가 인사를 한다. "Hi"  


"what is your name?" 이라고 하니까 "내 이름은  도로시에요." 라고 나온다. 

근데, 또 물어보면 딴 얘기함. 

그럴땐 리셋!!!


> :build Dorothy reset


introduction.top에서 영어를 국문으로 바꾸면 한국말 한다. ㅋㅋㅋ





...

반응형
반응형

[ChatScript] ChatScript - https://github.com/bwilcox-1234/ChatScript


Natural Language tool/dialog manager


ChatScript

Natural Language tool/dialog manager

ChatScript is the next generation chatbot engine that has won the Loebner's 4 times and is the basis for natural language company for a variety of tech startups.

ChatScript is a rule-based engine, where rules are created by humans writers in program scripts through a process called dialog flow scripting. These use a scripting metalanguage (simply called a "script") as their source code. Here what a ChatScript script file looks like:

#
# file: food.top
#
topic: ~food []

#! I like spinach
s: ( I like spinach ) Are you a fan of the Popeye cartoons?
	
	a: ( ~yes )  I used to watch him as a child. Did you lust after Olive Oyl?
    	    b: ( ~no ) Me neither. She was too skinny.
    	    b: ( yes ) You probably like skinny models.
	
	a: ( ~no ) What cartoons do you watch?
     		b: ( none ) You lead a deprived life.
     		b: ( Mickey Mouse ) The Disney icon.

#! I often eat chicken
u: ( ![ not never rarely ] I * ~ingest * ~meat ) You eat meat.

#! I really love chicken
u: ( !~negativeWords I * ~like * ~meat ) You like meat.

#! do you eat bacon?
?: ( do you eat _ [ ham eggs bacon] ) I eat '_0

#! do you like eggs or sushi?
?: ( do you like _* or _* ) I don't like '_0 so I guess that means I prefer '_1.

#! I adore kiwi.
s: ( ~like ~fruit ![~animal _bear] )  Vegan, you too...

#! do you eat steak?
?: ( do you eat _~meat ) No, I hate _0.

#! I eat fish.
s: ( I eat _*1 > ) 
  $food = '_0 
  I eat oysters.

Above example mentioned in article How to build your first chatbot using ChatScript.

Basic Features

  • Powerful pattern matching aimed at detecting meaning.
  • Simple rule layout combined with C-style general scripting.
  • Built-in WordNet dictionary for ontology and spell-checking.
  • Extensive extensible ontology of nouns, verbs, adjectives, adverbs.
  • Data as fact triples enables inferencing and supports JSON representation.
  • Rules can examine and alter engine and script behavior.
  • Planner capabilities allow a bot to act in real/virtual worlds.
  • Remembers user interactions across conversations.
  • Document mode allows you to scan documents for content.
  • Ability to control local machines via popen/tcpopen/jsonopen.
  • Ability to read structured JSON data from websites.
  • Postgres and Mongo databases support for big data or large-user-volume chatbots.

OS Features

  • Runs on Windows or Linux or Mac or iOS or Android
  • Fast server performance supports a thousand simultaneous users.
  • Multiple bots can cohabit on the same server.

Support Features

  • Mature technology in use by various parties around the world.
  • Integrated tools to support maintaining and testing large systems.
  • UTF8 support allows scripts written in any language
  • User support forum on chatbots.org
  • Issues or bugs on this repo

Getting started

Installation

Take this project and put it into some directory on your machine (typically we call the directory ChatScript, but you can name it whatever). That takes care of installation.

git clone https://github.com/bwilcox-1234/ChatScript

Standalone mode - run locally on a console (for developement/test)

From your ChatScript home directory, go to the BINARIES directory:

cd BINARIES

And run the ChatScript engine

Windows

ChatScript

Linux

./LinuxChatScript64 local

Note: to set the file executable: chmod a+x ./LinuxChatScript64

MacOS

./MacChatScript local

This will cause ChatScript to load and ask you for a username. Enter whatever you want. You are then talking to the default demo bot Harry.

Server Mode (for production)

From your ChatScript home directory, go to the BINARIES directory and run the ChatScript engine as server

Run the server on Windows

ChatScript port=1024

Run the server on Linux

./LinuxChatScript64

Run the server on MacOS

./MacChatScript

This will cause ChatScript to load as a server.
But you also need a client (to test client-server communication). You can run a separate command window and go to the BINARIES directory and type

Run a client (test) on Windows

ChatScript client=localhost:1024 

Run a client (test) on Linux

./LinuxChatScript64 client=localhost:1024

Run a client (test) on MacOS

./MacChatScript client=localhost:1024

This will cause ChatScript to load as a client and you can talk to the server.

How to build a bot

Run ChatScript locally. From the ChatScript command prompt, type

:build Harry

or whatever other preinstalled bot exists. If you have revised basic data, you can first:

:build 0

How to compile the engine.

On windows if you have Visual Studio installed, launch VS2010/chatscript.sln or VS2015/chatscript.sln and do a build. The result will go in the BINARIES directory.

On Linux, go stand in the SRC directory and type make server (assuming you have make and g++ installed). This creates BINARIES/ChatScript, which can run as a server or locally. There are other make choices for installing PostGres or Mongo.

Full Documentation

ChatScript Wiki (user guides, tutorials, papers)

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

Last releases

changes.md

Author


반응형

+ Recent posts