Skip to content

SIML guidelines

Łukasz Domeradzki edited this page May 31, 2017 · 27 revisions

SIML guidelines

When writing SIML for our AI brain, it's a good idea to stick with some common guidelines and best practices to write clean, efficient and properly working code. Those guidelines are general tips that you should take into account when writing SIML.


If given <Pattern> is not expected to be called by user, it should be prefixed with {Name}_ of the <Concept>.

For example, instead of:

<Concept Name="_bob">
  <Model>
    <Pattern>GET_RANDOM_CAT</Pattern>
  </Model>
</Concept>

You can write:

<Concept Name="_bob">
  <Model>
    <Pattern>_bob_GET_RANDOM_CAT</Pattern>
  </Model>
</Concept>

Thanks to that we won't need to fight with potential conflicts if the same pattern is declared twice in two different files.


Make use of pattern-matching in <Pattern> when only a few words differ between invocations.

For example, instead of:

<Concept Name="_bob">
  <Model>
    <Pattern>WHAT IS KALEITH</Pattern>
    <Pattern>WHAT IS THIELAK</Pattern>
    <Pattern>WHO IS KALEITH</Pattern>
    <Pattern>WHO IS THIELAK</Pattern>
  </Model>
</Concept>

You can write:

<Concept Name="_bob">
  <Model>
    <Pattern>(WHAT|WHO) IS (KALEITH|THIELAK)</Pattern>
  </Model>
</Concept>

At the same time you should still stick with multiple patterns when they're entirely different and they do not differ only by a few words.

Clone this wiki locally