Skip to content
Lymdun edited this page Mar 12, 2016 · 13 revisions

Welcome to the LymOS wiki!

I - Files
II - Basic Tools
III - Logs, variables and conditions
IV - Feature List

I - Files

The AI system operates in several parts, treated one after the other.

1) Index.php

This is the program that will receive the sentence of the user and respond, by digging information in other files, reading line by line from top to bottom.

2) Correction.txt

After receiving the sentence, index.php will correct any mistakes of the user with this file. Correction.txt the file is parsed line by line. If a word in the phrase of the user corresponds to what is written before the equal sign, it is replaced by what comes after. For example, the line "thiis = this is" transform the phrase "thiis certain" in "this is certain" This file is extremely convenient. It can be used to correct mistakes, but also to use synonyms or change gramaticales structures. For example "they call me = my name is".

3) AR.txt

This file is what I call a brain, or the principal core. It's divided into two parts, separated by an equal sign (=). Before the equal sign, the piece of sentence to which the program should respond. After the equal sign, the answer that the program has to give. For example "hello = Hi my friend!" means that if the program receives "hello", he will answer "hello my friend" and stop. It's that simple. No quotes, no tags, just to put an equal sign and a line jump.

Of course, one can happily save variables, add conditions, reuse phrases scraps etc. LymOS use more cores: AR.txt, insultee.txt (when insulted) and aidemod.txt (to help change it). One can imagine the brain changing chatterbot by language, age or gender of the interlocutor ... You can change your core with the "chgcerva".

4) Correctionbot.txt

This file replaces the words of the response of the program are those defined in exactly the same way as correction.txt. It is necessary to use certain characters reserved for the analysis of the sentence, functions, variables or conditions.

These are characters such as "{" "~" "()" "[" or "|" is used very rarely anyway in a conversation. If you still need that your program uses, type to the left of the equals sign, eg "symbspejok" for "()". You can also use it to replace something else, eg "botmaster" in your nickname, "lieuhab" in the place where you live. So if you decide to change a parameter quickly, you only have to edit this file.

II - Basic Tools

Equal Sign

= Separates action to detect the reaction to use.

Example : I'm hungry = You only have to eat!
If the sentence of the user contains the characters before the equals sign, then the program returns the response located after the equal sign.

User: but uh I'm hungry serious!
LymOS: You just have to eat!

Joker

(*) To substitute any piece of sentence.

Example :
I (*) hunger = Why don't you eat!
If the sentence of the user contains a piece of what is before wildcard, then pieces of what's after the wildcard in that order, then the sentence is recognized.

User: but uh I (very) hungry me seriously!
LymOS: You just have to eat!

Beware, it also works with:
User: By the way, I forgot my dog. I think he's hungry lol
LymOS: You just have to eat!

This is an excellent tool, but use with caution. It also consumes a lot of resources. It is possible to use several wildcards.

The vertical bar BEFORE the equal sign

| Impose a beginning or an end to the phrase.

Example : | me = Stop everything back to you!
In the example above, that we put what I call a "side limit". To be recognized that the phrase requires that the user starts her sentence with "me."

User: me!
Bot: Stop everything back to you!

Useful for detecting sentence starters (eg "| do not talk to me" prevents the detection of "I do not talk to me") or short words (| Clear |).

The vertical bar AFTER the equal sign

| Offers different answers. One will be used at random.

Example :
I (*) = hunger Why do not you eat! | As a robot, I do not have this problem. | Humans always complaining!
Here, the program will respond to "I am hungry" or "Why do not you eat!" Or "As a robot, I do not have this problem." I recommend at least 3 different answers, but that is not always easy to find.

The tilde

~ To search through a list of words.

Example:
hello=Hello!
In this example, we look if the given sentence is a list of synonymous words of greeting (eg hello, hi, good evening etc.).
This word list is stored in the "gen" folder and the file name is shown between the tilde (here, for example "bonjour.txt"). It is possible to use boundary side in the gen files, but no wildcards.

Attention you can't combine tilde with wildcards or other tilde. Combine them with plain text or side limits is possible.
Example: "|I like to say hello to people." is correct.

You can use "continue" and also variables to pass this limitation but note that the tilde are not there to replace the brain. This tool is used for the detection of several synonyms ad hoc basis. Use correction.txt to create synonyms permanently.

III - Logs, variables and conditions

Logs

When I started creating the program, I told myself I was going to save user's conversation history (what is called a log), and analyze it to find out what had been said by bot or not. If the sentence was already stored in the log, the program was not to use it.
Of course, the problem is that there is a infinity of synonyms. If the bot wants to ensure that "good evening" was not said, it must also check "hello".

The idea was then to create a parallel log, a special "log", which could look like this:
User: Hi!
LymOS: [greetings] [ask if health is good]
User: Yes, and you name?
LymOS: [gives its name]
User: The name of shit!
LymOS: [Insults]
etc.

Thus, the AI would easily check that it has not ever used a greeting, for example. Hence the creation of "special logs".

Special Logs

A special log is a string surrounded by brackets that synthesizes a response to the program do not reuse a similar response. Special logs can be added either before or after the equal sign. Attention, it is possible to use several special logs at once after the equal sign, but only one forward (to fix, but nothing urgent personally I just put the post if I have several).

Example before:
Goodnight [greetings] = Hi you! | Good evening visitor. | Yo man!

Example after:
Goodnight=Hi you! [greetings] | Good evening, visitor. [greetings] | Yo man! [rap greetings]

Special temporary logs

A special temporary log is a string surrounded by brackets and preceded by "temp". They last only the time of a user action. They can be added either before or after the equal sign. Attention, it is possible to use more temporary logs at once after the equal sign, but only one forward (to fix, but nothing urgent personally I just put the post if I have several).

Example: I'm hungry [greetings] = You ate long ago? [Temp: eaten long ago asked]

The user will respond and then temporary log will fade. They are typically used to wait for a reply or add a clarification on what was said.

Variables

In terms of the variables, see the "modvar" function below.

Conditions

The conditions are like logs, but with braces.

Test whether a log exists

Just put the log to test between braces instead of among hooks.

Example: {greetings}hello = You've already said hello!

It's the same for temporary logs, eg "{Temp: eaten long ago asked}". It is possible to combine the conditions and use them anywhere in the line. Be careful not to confuse conditions and logs! A log is in brackets, a condition between accolade.

Test whether a log does not exist

Add "nulle" before the test log.

Example: {nulle greetings}hello = You did not say hello to me!

In practice, this rarely used. The brain is read from top to bottom. If the program does not stop on {greetings} is that the log does not exist, no need to put a nulle.

Testing time

Example: {heure 17-22}hello[greetings]= Hey, good evening ?[temp: good evening?] | Hi! You spend a good evening ?[temp: good evening?]

If it is 17, 18, 19, 20 or 21 hours, the condition is right. Note that the example uses a condition, a special log, a generic response, a temporary log... There are still no plans for the date.

Variables tests

Emphasize special logs to variables. The difference between the two is that variables can contain information given by the user (rare) and be changed. I use it in LymOS to store the current topic, the user's state of health or information such as name, where he lives, the last words used... Note that the variable "nom" is a special variable, instead use "user_name" or something like that instead.

Testing the existence of a variable

Example: {var subject}=Thank you for talking <-var subject-> I'm sure it will help me improve.

If the variable "subject" exists, the answer "Thank you for speaking <-var subject-> I'm sure it will help me improve" will be used.

Testing the non-existence of a variable

Example: {nulle var subject}=We talked about nothing!

If the variable "subject" does not exist, the response "We talked about nothing!" will be used.

Test the value of a variable

I use ":>" to test a variable, it's not a very orthodox syntax, it was chosen because it is easier to test in the php code.

Example: {var subject:>video games} = I love video games, virtual worlds, all that!

If the variable "subject" contains "video games", the returned response will be "I love video games, virtual worlds, all that!".

Reuse a variable

To use a variable before or after the equal sign. View functions.

Example: <-var(dwellingplace)->=Yes, that's where you live! <-var(dwellingplace)->!

In this example, if the user action is the content of dwellingplace, the program responds "Yes, that's where you live" and displays the contents of dwellingplace.

IV - Feature list

Noreut

Noreut - Prevents use of the phrase a second time response.

Example: <-noreut->
The sentence of complete response and unformatted (even with all functions) will never be used again.

Continuer

Continuer - Once the analysis and found the answer, allows for further analysis.

Example: <-continuer->
Can be used to construct sentences with different pieces.

Ignorer

Ignorer - Allows to jump the found sentence.

Example: <-ignorer->
Allows to lower the probability of a sentence to be used. It is possible to modify the special logs.

(*)

(*) - Repeats the last joker.

Example: (*)
Repeats the joker of the sentence being analyzed.

(*X)

(*X) - Répète le jocker numéro X.

Example: (*number)
It is possible to process up to 20 wildcards.

Modvar

Modvar - Modifies a variable.

Example: <-modvar(Variable name, value)->
Modifies a variable. If it does not exist, it is created.

Heure

Heure - Displays time.

Example: <-heure->
H :i

Date

Date - Displays the date.

Example: <-date->
d/n/Y

Url

Url - Create a link.

Example: <-url(Title of url,url->

Clicrep

Clicrep - Created a clickable link sending an answer.

Example: <-clip(Party to make clickable,response to send->
Simulates a user response with a javascript function.

Rappel

Rappel - Alerts the user with a sound file after X minutes.

Example: <-rappel(Number of minutes,something to remember)->
Add a variable corresponding at the time of the reminder in the variable of session reminder. In every load of the page, verify if the hour corresponds, and activates alarme.wav where appropriate, while sending "rappel" to the autoresfresh brain. Experimental feature.

Note: a single reminder by sentence. Use continue if you really need several reminders.

?Rappel

?Rappel - Verify if there is a rappel.

Example: <-?rappel->
Used for cases where the user requests "you have to remember something soon? ". Experimental feature.

Var

Var - Displays the contents of a variable

Example: <-var(Variable name to be displayed)->
Running before and after the equal sign.

Compter

Compter - Calculates the given formula.

Example: <-compter(Formula to count)->
This function changes the sentence of the user in " errcalc " if the calculation cannot be solved.

Inc

Inc - Call an external script.

Example: <-inc(Script name[,parameter 1,parameter 2..])->
Can significantly extend the capabilities of LymOS without having to edit the main script. See example titrejournal.php function.