Moogsoft Docs

Creating a simple Canonicalized Description


This simple Lambot Module isn't intended to be a full-fledged canonicalization module though it could be extended as such by adding tokenization/normalization, stemming, stop word handling, etc. Rather it is just meant to be a simple yet effective approach to preventing simple numerical differences impede string similarity matching in Cookbook recipes

  1. Create a Lambot module named Canonicalization.js (or similar name of your choosing) with the following content:

    function Canonicalization() {
        var mLogger=LamBot.loadModule("Logger");
        var self={
            canonicalizeDescription: function(description)
                    description=description.replace(/[^a-zA-Z ]/g,'');
                    return description.toLowerCase();
        var F=function() {};
        return( new F() );
  2. Add a reference to the module in your LAM conf file:

                modules: ["Canonicalization.js"]
  3. Use the module in your Lambots (an example is shown below):

    var canonicalization = new Canonicalization();