SilviaCoreManager.CreateCore

Creates a SILVIA Core into which you can load or merge SILVIA Brain Files and other content.

Description

The Studio Editor issues Cores automatically as part of the Load Brain File function, but to load a SILVIA Core in from an external C# script, call the SilviaCoreManager as follows:

Example Usage (C#)


using CognitiveCode.Silvia.Api;

public class LoadSilviaCoreAndBrain : Monobehaviour { public SilviaCore Core;
public bool corePresent;
public string brainFilePath = "/Assets/BrainFiles/brain.sil"; public void CreateSilviaCore() {
//Creates a SilviaCore, assigns the public reference to it
Core = SilviaCoreManager.CreateCore("Username", null, null, null, null, "license", null);
Core.SetCreated(); corePresent = true;
//Load a Brain File Into Core Memory (filePath, merge, boot) Core.ApiMem().Load(brainFilePath, false, true);
}
}

Parameters

string

username

The Username to assign to the created SILVIA Core.

binaryReader

brainStream

BinaryReaders can be used to move from a TextAsset of a SILVIA Brain File to a Stream / Memory Stream of the bytes in said TextAsset, which you then wrap in a BinaryReader to supply to this function.

Supplying a null value for this parameter to CreateCore, and then using ApiMem().Load to point at the Brain File path is shorter.

string

stopwords

The string list of Stopwords to ignore in the new SILVIA Core. Stopwords can be edited and flagged in the Concept Editor, so supplying a null here works.

string

scriptClassType

The script class type for the Core; supplying a null will default to C#.

string

internalScriptclassName

Special script class declaration. Supplying a null works.

string

licensePath

The relative Path of the SILVIA Core License.

object

o

Target Object, supplying a null has no effect on the success of creating a SILVIA Core.

Returns A SILVIA Core object reference.

See Also

  • SilviaCoreManager.ReleaseAllCores
  • Core.SetCreated