PHP Classes

File: examples/case-studies/macros/semantic_macro_trigger/semantic_macro_trigger-GR.md

Recommend this page to a friend!
  Packages of Christos Drogidis   Ascoos OS   examples/case-studies/macros/semantic_macro_trigger/semantic_macro_trigger-GR.md   Download  
File: examples/case-studies/macros/semantic_macro_trigger/semantic_macro_trigger-GR.md
Role: Documentation
Content type: text/markdown
Description: Documentation
Class: Ascoos OS
A PHP Web 5.0 Kernel for decentralized web and IoT
Author: By
Last change:
Date: 8 months ago
Size: 4,227 bytes
 

Contents

Class file image Download

???????????? ???????????? ????? NLP ???????? ??????????? ????????????

???? ? ?????? ?????????? ??????? ??? ?? Ascoos OS ?????? ?? ????????? ???????????? ????? ?????????? ???????? ??????????? ????????????. ???????????? ???????? NLP ??? ?? ????????? ?? ?????????? ??? ?? ???????? ??? ??????, ??? ??????????? macros ???? DSL script ??? ???????????? ?? AST.

??????

  • ??????? ?????? ?? `TLanguageProcessingAIHandler`
  • ?????????? ????????????? ??? ??????????????? ???????
  • ??????? ??????? macro ???? DSL
  • ????????? DSL ?? ??????????? ???????
  • ???????? macros ???? ?????????? ?????????? ????????

?????? ??????? ??? Ascoos OS

  • TLanguageProcessingAIHandler NLP ???????, ?????????? ??????? ??? ?????????????
  • AbstractDslAstBuilder ??????? DSL ?? AST ???????
  • AstMacroTranslator ????????? AST ?? ??????????? ????????? ??? ????????

???? ???????

? ?????? ??????????? ?? ??? ?????? PHP: - semantic_macro_trigger.php

???????????? ??? ?? ??????: NLP ???????, DSL parsing, AST ????????? ??? ???????? ???????.

??????????????

  1. PHP ? 8.2
  2. ????????????? ?? Ascoos OS ? ?? AWES

?????????? DSL

WHEN sentiment = negative AND topic = "economy" THEN
    TAG "alert"
    NOTIFY "Editor"
    FLAG "Review"

??? ?????????

  1. ? `TLanguageProcessingAIHandler` ??????? ?? ?????.
  2. ?? ?????????? ???????? ?? `naiveBayesSentiment()`.
  3. ?? ??????? ??????????????? ?? `conceptActivationVector()`.
  4. ?? DSL ???????????? ?? AST ?? `AbstractDslAstBuilder`.
  5. ? `AstMacroTranslator` ???????????: - `TAG` ? ???????? ???????? - `NOTIFY` ? ?????????? ???????? - `FLAG` ? ?????????? ??? ??????????
  6. ?? ??????? ??????????? ???? ?? ? ??????? ????? ??????.

?????????? ??????

$text = "...";
$nlp = new TLanguageProcessingAIHandler();
$sentiment = $nlp->naiveBayesSentiment($text);
$concepts  = $nlp->conceptActivationVector([...], [$text]);

$dsl = <<<DSL
WHEN sentiment = negative AND topic = "economy" THEN
    TAG "alert"
    NOTIFY "Editor"
    FLAG "Review"
DSL;

$astBuilder = new class extends AbstractDslAstBuilder {};
$ast        = $astBuilder->buildAst($dsl);

$translator = new class([...]) extends AstMacroTranslator {};
$macroContainer = $translator->translateAst($ast);
$macroContainer->executeIfTrue();

??????????? ??????????

??? ?? ?????????? ????? ???????? ??? ? ???????? ????? "economy":

?? Tagged: alert
? Notification sent to: Editor
? Flagged for: Review

?????

??????????

???????? ?? ??????????? ?? DSL ?? ???? ???????, ?? ???????????? ???????? NLP ??????? ? ?? ???????????? ??? ????????? macro. ????? ?? CONTRIBUTING.md ??? ???????.

????? ??????

???? ? ?????? ?????????? ??? ??? Ascoos General License (AGL). ????? ?? LICENSE.md.