Search code examples
clipsexpert-system

Write farsi in CLIPS(expert system)


I try to implementation a Expert System with Clips but clips doesn't support Farsi. How do I write Persian in CLIPS?

Thank you.


Solution

  • CLIPS 6.3 internally supports UTF-8 strings, however, the application embedding CLIPS must also support UTF-8 I/O. The CLIPS Windows IDE does not support UTF-8 I/O. It uses older Win32 APIs and was not designed with unicode support in mind. The Mac OS X IDE, however, does support UTF-8 I/O:

    CLIPS> 
    (defrule hello
       =>
       (printout t "Hello" crlf)
       (printout t "Olá" crlf)
       (printout t "Здравствуйте" crlf)
       (printout t "مرح" crlf)
       (printout t "你好" crlf)
       (printout t "Γεια σας" crlf)
       (printout t "こんにちは" crlf)
       (printout t "안녕하십니까" crlf))
    CLIPS> (run)
    Hello
    Olá
    Здравствуйте
    مرح
    你好
    Γεια σας
    こんにちは
    안녕하십니까
    CLIPS> (read)
    سلام
    سلام
    CLIPS> 
    

    When compiled as a console application, UTF-8 support for console I/O is environment dependent. A console version of CLIPS compiled with Darwin on Mac OS X supports UTF-8 automatically for console I/O. Apparently there is also some support in the Windows Command Prompt for UTF-8 console I/O if it is configured properly: Unicode characters in Windows command line - how?.

    CLIPSJNI, http://clipsrules.sourceforge.net/CLIPSJNIBeta.html, also demonstrates how you can embed CLIPS in an environment supporting UTF-8 (in this case Java) to take advantage of CLIPS internal support of UTF-8.