SimpleAI

September 5, 2017 ยท View on GitHub

What is it?

SimpleAI adalah package code yang bisa digunakan untuk menerapkan AI (Artificial Intelligence) secara sederhana, khususnya untuk implementasi NLP (Natural Language Processing).

SimpleAI ini dibangun dalam bahasa Pascal, khususnya dengan freepascal. Untuk memudahkan dalam proses development, telah disediakan juga package untuk digunakan di dalam IDE Lazarus

SimpleAI dibangun secara sederhana, data diambil dari file biasa, tanpa menggunakan RDBMS yang sudah ada.

Untuk meningkatkan performat, telah disediakan juga fitur untuk koneksi ke Redis. Untuk Production atau penggunaan trafik yang tinggi, disarankan untuk menggunakan Redis sebagai pilihan data storage-nya.

Why use it?

Ringan Tanpa Beban

SimpleAI dibuat dengan sederhana, simple dan ringan. SimpleAI adalah binary application sehingga diharapkan akan lebih cepat dan ringan.

How to use it

Requirements

Instalation

Jika menggunakan Lazarus, buka file "simpleai_package.lpk" dan install file tersebut.

SimpleAI USAGE

SimpleAI := TSimpleAI.Create;
SimpleAI.AddEntitiesFromFile( 'entities-pulsa.txt');
SimpleAI.AddEntitiesFromFile( 'entities-hotel.txt');
SimpleAI.AddEntitiesFromFile( 'entities.txt');
SimpleAI.AddIntentFromFile( 'intents-pulsa.txt');
SimpleAI.AddIntentFromFile( 'intents-hotel.txt');
SimpleAI.AddIntentFromFile( 'intents-danlainlain.txt');
SimpleAI.AddIntentFromFile( 'intents.txt');
SimpleAI.AddResponFromFile( 'response.txt');

.
.
.

Text := 'hi apa kabar?';

if SimpleAI.Exec(Text) then
begin

  // output dalam format text (result saja)
  ResponseString := SimpleAPI.SimpleAI.ResponseText;
  
  // output dalam json format
  json := SimpleAPI.SimpleAI.ResponseJson;

  //
  Action := SimpleAI.Action;
  IntentName := SimpleAI.IntentName;
  Params := SimpleAI.Parameters;
  
  // do something
  .
  .
  .

end;

Format JSON Output

{
	"code": 0,
	"request": {
		"text": ""
	},
	"response": {
		"intents": {
			"action": "",
			"name": "",
			"parameters": {}
		},
		"text": []
	}
}

Documentation

Take a look at the repo Wiki for further information and tutorials! Feel free to improve!

Projects with this library

Here's a list of projects that feats this library, feel free to add yours!

Troubleshooting

If you like living on the edge, please report any bugs you find on the SimpleAI issues page.

Contributing

See CONTRIBUTING for more information.

License

Please see the LICENSE included in this repository, which this project is licensed under.

Credits

Credit list in CREDITS

Carik Bot