Advanced Smart Tag Tools

This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.

 

Chris Kunicki, OfficeZealot.com
Chris Boar, Microsoft Corporation
Anthony Dowler, Entirenet

Created: May 2001
Revised: July 2001

Applies to:
     Microsoft® Office XP

Download odc_stadvtoolssamp.exe.

Summary: This article discusses three advanced smart tag development tools: the Smart Tag MOSTL Generator tool, which allows you to build smart tag XML list files; the Smart Tag List Builder tool, which allows you to build smart tag XML list files and list update files; and the MakeTrie and TestTrie tools, which allow you to build and test smart tag binary format files. (15 printed pages)

Contents

Introduction The Smart Tag MOSTL Generator The Smart Tag List Builder MakeTrie and TestTrie

Introduction

This article discusses three advanced smart tag development tools for the Microsoft® Office Smart Tag List Tool (MOSTL): the Smart Tag MOSTL Generator tool, which allows you to build smart tag XML list files; the Smart Tag List Builder tool, which allows you to build smart tag XML list files and list update files; and the MakeTrie and TestTrie tools, which allow you to build and test smart tag binary format files.

The Smart Tag MOSTL Generator tool was developed by Chris Kunicki of OfficeZealot.com. His tool consists of a Microsoft® Excel spreadsheet template that can be found in the sample download with the file name SmartTagMOSTLGenerator.xlt.

The Smart Tag List Builder tool was developed by Chris Boar of Microsoft. This tool consists of a dynamic-link library (DLL) that can be found in the sample download with the file name STTools.dll.

The MakeTrie and TestTrie tools were developed by Anthony Dowler of Entirenet. These tools consist of two executable files that can be found in the sample download with the file names maketrie.exe and testtrie.exe.

The Smart Tag MOSTL Generator

Smart tags allow developers to push relevant and critical information to the places where users work in Microsoft® Word, Microsoft Excel, and Microsoft® Outlook. This can save users time, as they do not need to leave the application they are working in to dig for information elsewhere. In addition, smart tags make users more efficient by providing them with information that they otherwise might not know about.

As you start to develop smart tags, you will have many wonderful ideas about how they can help your organization. Before you know it, you may have too many ideas to implement. For this reason, prototyping a smart tag concept before actually starting the design and development process can be beneficial. The benefits of prototyping include:

  • Verifying whether the smart tags actually add value to the users' experiences.
  • Experimenting with terms to be recognized. Are the right terms being recognized? Are too terms many being recognized? Are some terms being missed?
  • Experimenting with associated actions, and determining whether the actions helpful or confusing.
  • Focusing on what is practical and not wasting energy on ideas that won't be used.

With this in mind, it made sense that we needed a smart tag prototyping tool. As we set out to build one, we came up with the following goals:

  • No coding should be required.
  • Users should be able to quickly build smart tags as needed.
  • It should be easy enough for users to create their own smart tags.

With these goals in mind, it was clear that MOSTL would do the job. MOSTL enables you to publish an Extensible Markup Language (XML) file according to the specifications in the Microsoft Office XP Smart Tag SDK. The MOSTL XML file tells Office XP what terms to recognize and the associated actions to support. To generate the MOSTL XML file, we created a simple Microsoft Excel 2002 spreadsheet template called SmartTagMOSTLGenerator.xlt, which is included in the sample download mentioned at the beginning of this article.

Using the Smart Tag MOSTL Generator

The MOSTL Generator spreadsheet is used to gather all the required information, as shown in Figure 1. The SmartTagMOSTLGenerator.xlt spreadsheet template has been populated with sample data and inserted comments to help users understand how to use the spreadsheet. These comments appear as red triangles in the upper right hand corner of cells.

Aa140239.odc_stadvtools1(en-us,office.10).gif

Figure 1. The SmartTagMOSTLGenerator.xlt spreadsheet template used to gather all of the key MOSTL XML elements.

Referring to Figure 1, the following sections of information are required.

  1. **MOSTL Properties Section
    **Collects basic information about the smart tag. This includes its friendly name displayed to users, the locale ID for language selection, a friendly description of the smart tag's purpose, a Uniform Resource Locator (URL) for more information, a unique smart tag type defined as a namespace, and finally a caption to be used as the header for the smart tag menu inside of Word and Excel (see Figure 2 for an example of a header caption).

    Aa140239.odc_stadvtools2(en-us,office.10).gif

    Figure 2. The sample smart tag created by SmartTagMOSTLGenerator.xlt spreadsheet template in action

  2. **Actions Section
    **A list of actions for this smart tag. First, a unique ID is needed for each action. This ID can be any string as long as it is unique. A caption is needed for each action to tell users what the specific action will do. These captions are displayed to users when they select a smart tag in a document (see Figure 2 for an example of the captions). Finally, a URL for the associated action is defined. The format for the URL is flexible. It can be any valid URL. A token "{TEXT}" can be inserted into the URL. When the URL is loaded, the term that is recognized replaces the {TEXT} token. This allows the user to send in a dynamic URL based on the term recognized.

  3. Recognizer Terms Section
    A list of terms to be recognized. This list can be typed in manually or inserted through a query. Excel provides a number of useful data query tools that can be used to insert a list of terms from either a database or the Web. To insert database data, from the Excel Data
    menu, point to Import External Data, and then click Import Data. Then follow the steps in the wizard to connect to a database and import a list of terms. To link to data on a Web page, use a Web Query. You can access Web Queries from the Excel Data menu by pointing to Import External Data, and then clicking New Web Query.

After this information is gathered, the user clicks the Export MOSTL XML button. Using a simple Visual Basic® for Applications (VBA) routine, the MOSTL XML file is published to the proper Office XP directory. Listing 1 shows the XML that is created.

<?xml version="1.0" encoding="UTF-16"?>
<FL:smarttaglist xmlns:FL="urn:schemas-microsoft-com:smarttags:list">
    <FL:name>Web Standards Smart Tag</FL:name>
    <FL:lcid>1033</FL:lcid>
    <FL:description>Test of Smart Tag List Generator for 
      Excel</FL:description>
    <FL:moreinfourl>http://</FL:moreinfourl>
    <FL:smarttag type="urn:schemas-
      smarttaglistgenerator:excel#webstandards">
        <FL:caption>Web Standards (MOSTL)</FL:caption>
        <FL:terms>
            <FL:termlist>XML,XSLT,CSS,HTML,JavaScript,VBScript,</FL:termlist>
        </FL:terms>
        <FL:actions>
            <FL:action id="msdn">
                <FL:caption>MSDN Web Site</FL:caption>
                <FL:url>http://search.microsoft.com/us/dev/default.asp?qu={TEXT}
         </FL:url>
            </FL:action>
            <FL:action id="deja">
                <FL:caption>Google Newsgroup Search</FL:caption>
                <FL:url>http://groups.google.com/groups?q={TEXT}
            </FL:url>
            </FL:action>
        </FL:actions>
    </FL:smarttag>
</FL:smarttaglist>

Listing 1. The MOSTL XML file created by the SmartTagMOSTLGenerator.xlt spreadsheet template

The ExportSettings tab contains additional configuration information that is needed to publish the MOSTL XML. The first data element is the directory to publish to. The directory C:\Program Files\Common Files\Microsoft Shared\Smart Tag\Lists\ is the default directory used by Office XP for storing MOSTL XML files. Depending on your configuration, this directory may need to be changed. The second data element is a name for the MOSTL XML file to be saved. By default, a formula constructs a file name from the friendly name on the SmartTagDetails tab. The user can overwrite this name by simply typing a new name in the cell.

If you look in the C:\Program Files\Common Files\Microsoft Shared\Smart Tag\Lists\ directory, you will see two other files: STOCKS.XML and STOCKS.DAT. These files are installed with Office XP. The Office development team is using the MOSTL directory to provide stock-ticker recognition and actions. That the Office development team is using MOSTL is a good indication that this technology is solid and is a trustworthy framework.

As a side note, if your system is not using the default MOSTL directory, search your hard drive for the STOCKS.XML and STOCKS.DAT files. This will tell you which directory Office XP uses for storing MOSTL XML.

How Does It Work?

Excel 2002 makes it easy to create the MOSTL XML. In Excel 2002, the Range object's value method has been extended to return XML:

Range.Value(xlRangeValueXMLSpreadsheet)

Using this, the XML can be retrieved. It can then be transformed using the XSL Transformation language (XSLT for short) into MOSTL XML. The SmartTagMOSTLGenerator.xlt spreadsheet template leverages this capability. Listing 2 shows the VBA code that extracts the SmartTagDetails tab as XML and transforms it with the XSLT that is stored in the spreadsheet.

Dim rngXML As Range
Dim rngXSL As Range
Dim XMLSource As MSXML2.DOMDocument30
Dim XMLXSL As MSXML2.DOMDocument30
Dim XMLTransform As MSXML2.DOMDocument30

Set XMLSource = New MSXML2.DOMDocument30
Set XMLXSL = New MSXML2.DOMDocument30
Set XMLTransform = New MSXML2.DOMDocument30

Set rngXML = Worksheets("SmartTagDetails").Range("MOSTLData")
'XSLT for transformation.
Set rngXSL = Worksheets("XSL").Range("XSLtoFL")  
'Retrieve the XML from the range as an XML spreadsheet.
XMLSource.loadXML rngXML.Value(xlRangeValueXMLSpreadsheet)
XMLXSL.loadXML rngXSL.Value

'Transform the XML extracted from the SmartTagDetails sheet with XSLT 
      stored in the range XSLtoFL.
XMLSource.transformNodeToObject XMLXSL, XMLTransform
XMLTransform.Save Range("ExportDirectory") & Range("ExportFileName")

MsgBox "MOSTL XML Exported!" & vbCrLf & vbCrLf & _
    "Restart Excel for SmartTags to take effect in Excel."

Listing 2. The VBA code that extracts the SmartTagDetails tab as XML and transforms it with the XSLT that is stored in the spreadsheet.

Let's examine the code line by line.

The following code creates two Range objects. First, the rngXML variable returns the data provide by the user in the SmartTagDetails tab. Then, the rngXSL variable returns the XSLT that is stored in cell A2 on the XSL tab.

Set rngXML = Worksheets("SmartTagDetails").Range("MOSTLData")
'XSLT for transformation.
Set rngXSL = Worksheets("XSL").Range("XSLtoFL")  

The XML from the rngXML variable and the XSLT from the rngXSL variable are loaded into MSXML 3.0 DOMDocument objects:

XMLSource.loadXML rngXML.Value(xlRangeValueXMLSpreadsheet)
XMLXSL.loadXML rngXSL.Value

Then the XML returned by Excel is transformed with the XSLT using the transformNodeToObject method. The resulting MOSTL XML is stored in XMLTransform. Finally, using the XMLTransform variable's Save method, the XML is saved to a physical file in the MOSTL XML file directory:

XMLSource.transformNodeToObject XMLXSL, XMLTransform
XMLTransform.Save Range("ExportDirectory") & Range("ExportFileName")

As you can see, only a few lines of code are needed to create the MOSTL XML.

Summarizing the Smart Tag MOSTL Generator

Excel is a widely used tool. For that reason, it is an ideal client tool for the Smart Tag MOSTL Generator. Excel provides a number of useful data-entry and data retrieval services that many users are comfortable with. Combined with its ease of use and the new XML programmability features, it was a snap to program this utility in no time with Excel. Now teams and users can quickly produce smart tag prototypes.

The Smart Tag List Builder

The more you work with smart tags, the more you realize how powerful they really are. If you give a knowledge worker a suitable set of smart tags, it is easy to see how productivity can be improved. Developers keen on jumping into the Smart Tag SDK and creating their own smart tag recognizers and actions should think about the different data types that knowledge workers use every day.

Many of these data types could exist as lists, making it easier to develop and deploy smart tags to support these data types. This section will discuss the importance of smart tag XML lists by explaining how to use the STTools COM object and its STListBuilder class. This section should help you understand the STListBuilder object model and reveal some next steps as you work with smart tag technology.

Smart Tag XML Lists

To utilize the built-in list-handling functionality needed to create a smart tag XML list, the file defines to the smart tag list handler the list of items to be recognized, some basic actions that can be applied to recognized items, and some useful list-update information.

Let's look at an example of a smart tag XML list:

<FL:smarttaglist xmlns:FL="urn:schemas-microsoft-com:smarttags:list">
    <FL:name>Customer SmartTag</FL:name> 
    <FL:lcid>1033</FL:lcid> 
    <FL:description>Customer Information</FL:description> 
     <FL:moreinfourl>http://advworks1/customers/smarttags.htm</FL:moreinfourl> 
    <FL:updateable>True</FL:updateable> 
    <FL:autoupdate>True</FL:autoupdate> 
    <FL:lastcheckpoint>100</FL:lastcheckpoint> 
    <FL:lastupdate>1</FL:lastupdate> 
    <FL:updateurl>http://cdbdev1/smarttags/update.xml</FL:updateurl> 
    <FL:updatefrequency>1</FL:updatefrequency> 
    <FL:smarttag type="http://adventure-works.msft#customer">
        <FL:caption>Adventure Works Customer</FL:caption> 
        <FL:terms>
            <FL:termlist>C00012,C00040,C00053,C00060,C00089,
      C00102,C00110, C00123,C00142,C00152</FL:termlist> 
        </FL:terms>
        <FL:actions>
            <FL:action id="Act1">
                <FL:caption>Sales Analysis</FL:caption> 
                 <FL:url>http://advworks1/customers/salesanalysis.asp?item={TEXT}
      </FL:url> 
            </FL:action>
            <FL:action id="Act2">
                <FL:caption>Adv Works Customers Web-Site</FL:caption> 
                <FL:url>http://advworks1/customers</FL:url> 
            </FL:action>
            <FL:action id="Act3">
                <FL:caption>Customers Web-Site</FL:caption>
                <FL:url>http://advworks1/customers/redirect.asp?item={TEXT}</FL:url> 
            </FL:action>
        </FL:actions>
    </FL:smarttag>
</FL:smarttaglist>

Understanding the Example XML

The XML tags in the example above are detailed in the smart tag SDK, so let's focus on the area that is most interesting for this discussion. The list can reference a location where new lists can be downloaded. The tags that allow this to take place are:

Tag Description
<updateable> Set to True to indicate the list can be updated.
<autoupdate> Set to True to indicate the list can be automatically updated.
<lastcheckpoint> Acts like a version number. If the checkpoint for the new list is greater than the local list then the list is downloaded.
<lastupdate> Set as the number of minutes since 1970. This data is used in conjunction with the <updatefrequency> tag to determine if a check should be made for a new list. This prevents excessive network traffic.
<updatefrequency> Set as the number of minutes between update checks. Once a new list is downloaded, this number of minutes must pass before checking for a new list.
<updateurl> A URL to an XML file that describes the available lists to download.

**Note   **The

<updatefrequency>

value of 1 in the smart tag XML list example above is only for demonstration purposes. A more normal value for this might be 10080 (the number of minutes in a week).

The update.xml file specified in the <updateurl> tag needs to match the list update schema definition. For example:

<FLUP:smarttaglistupdate xmlns:FLUP="urn:schemas-microsoft-com:smarttags:listupdate">
    <FLUP:checkpoint>400</FLUP:checkpoint>
    <FLUP:smarttaglistdefinition>customers.xml</FLUP:smarttaglistdefinition>
</FLUP:smarttaglistupdate>

The XML above instructs the smart tag list handler to download the file customers.xml if the checkpoint on the local list is less than 400. The download customer.xml file should have its <lastcheckpoint> tag value set to 400 to match the listupdate.xml file.

Let's summarize for a moment. We can provide smart tag functionality to our knowledge workers by supplying a simple XML file. We can include instructions in the XML file to have the file update automatically from a central server location.

This leaves two remaining issues:

  • How do we generate new XML lists easily?
  • How do we generate new XML list update files easily?

Of course, nothing stops you from developing server-side code that generates all the required XML. However, it is more logical to create a generic method for creating the two XML files and use this method repeatedly. This is an ideal opportunity for a COM object.

Understanding the STTools.STListBuilder Object

STTools is a COM object written in Microsoft Visual Basic 6.0, encapsulated as a DLL, and included in the download discussed at the beginning of this article. One of its objects, STListBuilder, can be used to create one or both of the XML files for smart tag lists and to add or remove individual entries from a list. Its most powerful ability is that it can take an ADO Recordset object and use that object to create the list.

Using the STListBuilder object to maintain an update list on a server

Perhaps one of the most common applications for the STListBuilder object is maintaining a smart tag XML list on a Web server. Assuming that the XML list is already deployed on client machines, the code below provides the necessary updated XML list file and the supporting update file:

Sub Update_ST_List(adoRs As ADODB.Recordset, 
      strFieldName As String, strFileLocation)
    Dim objSTListBuilder As New STTools.STListBuilder

    objSTListBuilder.LoadFromFile strFileLocation
    objSTListBuilder.LastCheckpoint = 
      objSTListBuilder.LastCheckpoint + 1
    objSTListBuilder.LoadTermsFromRecordset adoRs, strFieldName
    objSTListBuilder.SaveToFile strFileLocation, True
    Set objSTListBuilder = Nothing
End Sub

The subroutine above, called periodically on the server, will open the smart tag XML list, increment the <lastcheckpoint> value, rebuild the list from the recordset, and then save the XML back to the file. The second parameter on the SaveToFile method will generate a new UPDATE_<XMLfilename> XML file. The tag <updateurl> in the XML list file must be directed to the UPDATE_<XMLfilename> to ensure future automatic updates.

Using the STListBuilder object to create SmartTag XML lists

You can also use the STListBuilder object to create a smart tag list from scratch. For example, examine the following lines of code:

Sub ST_List_ Build()
    Dim adoCn As New ADODB.Connection

    adoCn.Provider = "SQLOLEDB"
    adoCn.ConnectionString = "Initial Catalog=Sales;Data Source=Sales1;"
    adoCn.Open

    Dim adoRs As New ADODB.Recordset

    adoRs.Open "SELECT CustomerName FROM Customers", adoCn

    Dim objSTListBuilder As New STTools.STListBuilder

    objSTListBuilder.AutoUpdate = True
    objSTListBuilder.Caption = "Adventure Works Customers"
    objSTListBuilder.Description = "Customer Information"
    objSTListBuilder.LastCheckpoint = "100"
    objSTListBuilder.LastUpdate = "1"
    objSTListBuilder.LCID = "1033"
    objSTListBuilder.MoreInfoURL = 
      "http://sales1/customers/cust_smarttags.htm"
    objSTListBuilder.RecognizerName = "Customer SmartTag"
    objSTListBuilder.SmartTagType = "http://adventure-
      works.msft#customer"
    objSTListBuilder.LoadTermsFromRecordset adoRs, "Ref"
    objSTListBuilder.Updateable = True
    objSTListBuilder.UpdateFrequency = 20160    'Every 2 weeks.
    objSTListBuilder.UpdateURL = 
         "http://sales1/customers/smarttags/update_
      cust.xml"
    objSTListBuilder.Actions.Add "Act1", 
      "http://sales1/customers/display.asp?item={TEXT}", 
      "Customer Information"
    objSTListBuilder.Actions.Add "Act2", "http://sales1/customers", 
      "Customer Info Web-Site"
    objSTListBuilder.SaveToFile 
      "c:\inetpub\wwwroot\customers\smarttags\cust.xml",false
End Sub

Understanding the STListBuilder object model

The object model is very simple:

Aa140239.odc_stadvtools3(en-us,office.10).gif

Figure 3. The STListBuilder object model

Most tags within the smart tag XML file are represented as properties of the STListBuilder object. As the number of actions defined in the file can vary (zero or more), an Action object controlled by an Actions collection represents the properties of each action.

Using additional methods of the STListBuilder object model

Various other methods of the STListBuilder object are also important to understand. Here are descriptions of some that are particularly useful.

  • **AddTerm(term As String)
    **Takes the passed string and, if the term is not already a member of the list, adds it to the list.
  • **DeleteTerm(term As String)
    **Removes the term passed if it exists in the list.
  • **LoadFromFile(location As String)
    **Loads the smart tag XML list from the location specified.
  • **LoadTermsFromRecordset(recordset As ADODB.Recordset, fieldname As String)
    **Builds a list using the recordset and field name. The list is cleared prior to building the new list.
  • **SaveToFile(location As String)
    **Writes the smart tag XML list file back to the location specified.

Taking Your Next Steps

Finally, smart tag XML list file actions are restricted to HTTP-based actions (actions that launch and navigate to a URL). This may seem limiting, as some of the most powerful capabilities of smart tags are their ability to feed information from the recognized object back into the host application document. Smart tag XML lists are still actually very useful for recognizing the data, but more capable actions are provided in the form of a smart tag action DLL.

Apart from the information presented here on smart tag solution development, you can find excellent information in the Smart Tag SDK and in the Microsoft training course 2380: Building Data Access, Analysis, and Workflow Applications with Microsoft Office XP.

MakeTrie and TestTrie

The Microsoft Office Smart Tag List Tool (MOSTL), described in the Smart Tag SDK, is a wrapper smart tag recognizer and action component designed to let developers create smart tags with HTTP-based actions quickly by placing the description of the smart tag in an XML file. This XML file is built according to the smart tag list schema described in the SDK, and contains information about the smart tag including a list of the text patterns it recognizes. The use of XML allows recognition terms to be stored quickly and simply in a well-known format. Nevertheless, there will be times when developers will want to store recognition terms in a binary format to avoid the limitations of the smart tag list schema, the XML file format, or for reasons of data integrity. In such cases, the MakeTrie tool can be used to create binary-format lists of recognition terms that are compatible with smart tag lists created using MOSTL.

The Advantages of Binary Recognition Lists

MOSTL allows for the creation of smart tag lists that support HTTP-based actions. Information about a smart tag list is contained in an XML file that matches the smart tag list schema. This schema allows a list of the terms that the smart tag recognizes to be included either as a comma-separated list within the XML file or as a separate binary data file. There are several advantages associated with each method.

Is Binary the Best Choice for Me?

Among the factors to consider in creating a smart tag list are storage, scalability and data integrity.

  • **Storage
    **Binary format is a more efficient storage medium than XML. A recognition list stored in a binary file will take less disk space and transfer more quickly over the network when installing or updating a smart tag. If storage space and transfer speed are major concerns, binary storage may be a better choice than XML.
  • **Scalability
    **While XML is simple and lightweight, an XML smart tag list will only support 5,000 recognition terms. If your smart tag is expected to recognize over 5,000 terms, or if it is likely to grow beyond that size over time, you will need to use a binary format to store your recognition list. The binary format supports up to 100,000 recognition terms.
  • **Data Integrity
    **Because XML files are plain text, it is quite easy for users to open and even edit them. Occasionally a user may unintentionally change the contents of an XML file, damaging the functionality of a smart tag list. Binary storage is no substitute for good security practices and infrastructure, but it does give a measure of protection against accidental tampering.

The smart tag list schema for encoding recognition lists as XML is fully described in the Smart Tag SDK. Note that the binary format recognition list can be updated in exactly the same way as the XML format list.

How To Use MakeTrie

Binary recognition lists are contained in a .bin file that is created by the MakeTrie tool described in the next section of this article. To use a binary format list, a pointer to the .bin file containing the list must be placed in the smart tag list XML file. This is done by adding a <termfile> tag to the XML file. This tag replaces the comma-separated list of values contained in the <terms> tag. The <termfile> tag should contain a <filename> node that contains the filename of the .bin file.

The following is an example of a list of terms used in a smart tag list that recognizes certain stock symbols:

<FL:terms>
   INTL, MSFT, CMPQ, QQQQ
</FL:terms>

Here is another example containing a pointer to a .bin binary file that could contain the same terms.

<FL:terms>
   <FL:termfile>
      <FL:filename>stocks.bin</FL:filename>
</FL:termfile>
   </FL:terms>
</FL:terms>

The .bin file should be placed in the smart tag list directory on the local machine where the XML file is located.

MakeTrie and TestTrie

Microsoft has created two tools that can be used to make and test binary recognition lists: MakeTrie and TestTrie. MakeTrie transforms a text list into a binary .bin file. TestTrie displays the recognition terms stored in a .bin file.

Using MakeTrie

MakeTrie is a command-line utility that takes a text file as input. Create a text file containing the list of terms that the smart tag list will recognize. The items should be listed one item per line. Note that the list of terms will be case sensitive, so you may need to include each term twice, once capitalized and once not capitalized.

For example, if you have your recognition terms in a file named Terms.txt, your command line could look something like this:

C:\maketrie.exe terms.txt

This command would create a binary list of recognition terms stored in a file named terms.bin.

You can specify a code page, including non-Unicode code pages, at the command line by using the /c switch. You can get more information about maketrei.exe by typing maketrie.exe –help from the command line.

MakeTrie best practices

There are several issues to keep in mind when using MakeTrie:

  • It is recommended that your text file be saved in Unicode format. If you do not save your text file in Unicode format, MakeTrie will be forced to guess at the code page to be used. This may lead to issues on some international systems.
  • Each line must have only one entry with a maximum length of 128 characters.
  • There must not be any duplicate entries.
  • There must not be any blank lines, including the last line in the text file.
  • MakeTrie sorts data alphabetically. This process will be faster if your text file is pre-sorted, thought this is not necessary.
  • Your recognition terms list is case sensitive. If you want your smart tag to recognize a term regardless of case, you need to include each term twice, once capitalized and once in lower case.

It is recommended that you use TestTrie to test your file once you have completed it.

Testing with TestTrie

TestTrie is a command line tool used to examine the contents of a .bin file created with MakeTrie. It takes a .bin file as input and outputs a list of terms contained in the .bin file. For example, the command C:\testtrie terms.bin lists all the terms contained in the file terms.bin.

You can specify a code page, including non-Unicode code pages, for the output by using the /c switch at the command line. You can get more information about testtrie.exe by typing testtrie.exe –help from the command line.

Summarizing MakeTrie and TestTrie

Maketrie.exe and Testtrie.exe are two command-line utilities designed to allow smart tag list developers to store smart tag recognition terms in a binary .bin file format. This is useful in situations where space or bandwidth is at a premium, the list of terms is very large, or there is a desire to protect the smart tag list from accidental tampering. More information on smart tag lists can be found in the Smart Tag SDK.

About the Authors

Chris Kunicki works with customers, architects and engineers to build cool desktop, enterprise, and Web applications at OfficeZealot.com. Chris is a long-time enthusiast of Office development and has been evangelizing Office as an important platform for building solutions by writing and speaking to users and developers. You can reach him at chris@officezealot.com. Check out his slant on things at http://www.officezealot.com.

Chris Boar is an Instructional Software Design Engineer working for the Collaborative Solutions Courseware team at Microsoft. Originally from England, Chris has been a programmer, an IT Manager, an e-mail specialist, and a Microsoft Certified Trainer. He says, "one day I must get a real job!" When not working, Chris enjoys spending time with his wife and 2.5-year-old daughter.