Method CreateFileDataSource
CreateFileDataSource(string, string, LM, MetadataCollection)
Creates a new file-backed DataSource instance with the specified identifier and language model. This method creates a new file at the given path and opens it with read-write access. The resulting DataSource is initially created in-memory and then associated with the backing file stream, enabling future updates to be synchronized with the file.
public static DataSource CreateFileDataSource(string path, string identifier, LM model, MetadataCollection metadata = null)
Parameters
path
stringThe file path where the data source will be created. This must be a valid path and the file must not already exist.
identifier
stringThe unique identifier for the data source.
model
LMThe language model associated with the data source.
metadata
MetadataCollectionOptional metadata to be associated with the data source.
Returns
- DataSource
A new DataSource instance that is backed by a file.
Exceptions
- ArgumentNullException
Thrown if
path
is null, empty, or consists solely of white-space characters.