Data Model > Extending the UNICOM Intelligence Data Model > Working with the Alias Map component > Replacing the Generator and Dictionary
 
Replacing the Generator and Dictionary
If the default generator cannot be configured to meet your requirements, you can replace the Generator object with a customized generator.
IMapper accepts a new IGenerator implementation:
Set IMapper.Generator = MyNewGenerator
IGenerator need not implement the NextMulti and ResetMulti functions unless multiple alias names are required for single input texts.
Before you replace the generator, make sure that there are no dependencies on the default generator configuration.
There are two ways to replace the generator:
Create a new instance of the standard implementation of IGenerator and then modifying the IGeneratorConfiguration object before inserting it into the IMapper object.
Create a new instance of a custom implementation of the IGenerator interface, which need not support the IGeneratorConfiguration interface.
Because most of the work is done in the default implementation of IGenerator, the first option is usually preferable. However, for special tasks or as an improved wrapper around the default implementation, you may sometimes want to use the second option, for example, when your naming problem cannot be solved by the standard component. The input text could be preparsed by a custom parser and then truncated using the standard IGenerator implementation. However, this is recommended for advanced users and COM implementers only and no example is shown here.
The generator can also be replaced with a new generator of the same implementation, simply to use a different configuration setup for a particular problem.
Although, the generator can in principle be shared between multiple IMapper objects, this is not recommended.
It is generally not necessary to create a new implementation of the dictionary, unless you want to use an existing database, for example. However, you may want to swap the generator to access a new namespace. Although you can also achieve this by swapping IMapper and configuring an additional generator.
See also
Regular expressions
Structure of the Alias Map component
Examples of using the Alias Map component
Creating multiple aliases
IGeneratorConfiguration
Examples of configuring the Generator
Working with the Alias Map component