项目作者: mbrioski

项目描述 :
PHP >=7.3 library for AIML files
高级语言: PHP
项目地址: git://github.com/mbrioski/AIML.git
创建时间: 2020-02-09T18:17:18Z
项目社区:https://github.com/mbrioski/AIML

开源协议:MIT License

下载


AIML library for php

Build Status

Aiml Php library for php, compatible with Php 7.3>=.

AIML stands for Artificial Intelligence Modelling Language. AIML is an XML based markup language meant to create
artificial intelligent applications.

AIML Reference

Supported language tags

  • <pattern>
  • <template>
  • <star>
  • <srai>

How install it

composer require ridesoft/aiml:~0.1.0

Base usage example

You can find this example in the robot.php file.
Run it with docker run -v ${PWD}:/var/www/html --rm -it php:7.4-fpm-alpine sh -c "php tests/robot.php"

  1. <?php
  2. require 'vendor/autoload.php';
  3. $file = new \Ridesoft\AIML\File();
  4. echo "Hello Aiml\n";
  5. echo $file->setAimlFile(__DIR__ . '/files/simple.aiml')
  6. ->getCategory('Hello Aiml')
  7. ->getTemplate() . "\n";
  8. $file2 = new \Ridesoft\AIML\File();
  9. $category = $file2->setAimlFile(__DIR__ . '/files/srai.aiml')
  10. ->getCategory('Who Mauri is?');
  11. echo "Who Mauri is? \n";
  12. if ($category->isTemplateSrai()) {
  13. echo $file2->getCategory($category->getTemplate($category->getStars()))
  14. ->getTemplate(). "\n";
  15. }

Contributing

I develop this library in my free time: any help is really welcome: i would like in any case to follow the best practise
using a TDD approach or at least write unit tests for the code.

The code follow PSR2 standards.

Check coding standards

  1. docker run -v ${PWD}:/var/www/html --rm -it php:7.4-fpm-alpine vendor/bin/phpcs --standard=PSR2 /var/www/html/src

Run unit test (using docker)

Spin up php7.4 container with:

  1. docker run -v ${PWD}:/var/www/html --rm -it php:7.4-fpm-alpine vendor/bin/phpunit