Powered by Zoomin Software. For more details please contactZoomin

Semaphore Publisher

Word Replacement Variant Generation

  • Last Updated: May 29, 2026
  • 1 minute read
    • Semaphore
    • Documentation

If you have a set of words that could be used in place of a words in a label, then we have a variant generator that works at the writer level to create the possible replacements. This is done at the writer level because the number of possible permutations that might arise if there are many words to be substituted in a single label - each with many options - may blow up exponentially.

Therefore, for either the kid writer or velocity writer you may add a property

<property name="variantExpander" ref="variantExpander" />

Where the variantExpander is defined as

  <bean id="variantExpander" class="com.smartlogic.publisher.kid.StringVariantExpander" >
    <property name="csvFileName" value="config/${model.name}/variants.csv" />
    <property name="replaceFirstItemOnly" value="false" />
    <property name="caseSensitive" value="false" />
  </bean>

or

  <bean id="variantExpander" class="com.smartlogic.publisher.kid.StringVariantExpander" >
    <property name="csvFilesNamesForLanguages" >
       <map>
          <entry key="en" value="config/${model.name}/variants_en.csv" />
          <entry key="fr" value="config/${model.name}/variants_fr.csv" />
       </map>
    </property>
    <property name="replaceFirstItemOnly" value="false" />
    <property name="caseSensitive" value="false" />
  </bean>

The csvFile should contain line for each set of words to be replaced. If “replaceFirstItemOnly” is false (the default) then any word in that set will be replaced by all the others. If it is set to true, then only the first will be replace by the others. If caseSensitive is false (the default) then the case of the word will be ignored during the subsitution.

For the second set, the substitution can be done differently for different languages. If there is no entry for a particular language then no substitution will occur.

TitleResults for “How to create a CRG?”Also Available inAlert