|
|
|
Access ELF Phrase Editor WindowThe Phrase Editor is where you can define substitutions for words or phrases typed-in as part of a question. This is often the easiest way to improve the responsiveness of your interface. Every industry has special terms, synonyms which won't be in any general purpose dictionary. Of course, many databases are inherited from the days when field names were limited to eight characters. (Old habits die hard, so people still tend to create fields named MTX_CRT -- whatever that means!) This is where you can teach the system whether people will be typing "matrix cartridges" or "miotoxin creatonin level" when they really mean the MTX_CRT field.
In fact, that's how we've labeled the columns of our Phrase Editor: The important thing to remember about Phrase Definitions is that they're not optional -- if you define a substitution, Access ELF will do it every time. In general, words can have different meanings and be used in different ways, as nouns, verbs etc. So in general Access ELF tries all different combinations when searching for the right translation of a question. This doesn't apply in the case of Phrase substitutions, which work like "macros" in a programming language. Only the I Really Mean: part of a definition is considered at all, the When I Type: pattern is thrown away.
So if a travel agent were to define "book" as "purchase", this would allow her to type The lesson is to avoid using the Phrase Definition facility with single words which have many meanings or associations. One alternative to the Phrase definition technique is to define words as synonyms of each other; for instance, the verb "book" could be defined as a synonym for the verb "purchase"; this would leave Access ELF free to interpret "book" either as a noun or a verb, and wouldn't block any of the associations it had generated on its own. For more details on Synonyms, see the Lexicon Lookup topic. For more specific words or phrases, though, nothing beats the Phrase Editor for quickly getting from "what you say" to "what you mean". Let's review some possible uses. First we'll look at the simplest case, called "lexical phrases". (You'll learn about the difference between lexical phrases and string phrases later.)
When I Type: paperback
I Really Mean: not hardcover
When I Type: Northwind
I Really Mean: NWND
When I Type: catalog information
I Really Mean: Category Name, Description, Picture, Product Name, Product ID, Quantity Per Unit, Unit Price
When I Type: salesperson
I Really Mean: employee
You can also cascade these definitions, for example: Finally, you can use this feature to give numerical meanings to expressions:
When I Type: college
I Really Mean: education >= 16
Although lexical phrase substitutions do work like macros, Access ELF is smart enough to detect words which
are part of compound constructions, and won't replace them. For example, you can define: If you have some programming skills, you might want to skip over this next part and go right to the Phrase Scripting section. With Phrase scripts, you don't need to rely on confusing string replacement rules -- you can define replacements that exactly suit your application, using your own VBScript or JScript functions. String replacement: While lexical phrase substitution is quite powerful, since it stems verbs and nouns prior to performing replacement, it's not the right tool for every job. There's another type of phrase replacement, which acts immediately before the lexical phrase facility. If you enclose the trigger (When I Type) part of a phrase rule in square brackets or double-quotes, the phrase (I Really Mean) part will be substituted for an exactly matching string. For example:
When I Type: [buy]
I Really Mean: order One difference between this method and the method described above is that this rule won't change "bought" (the past form of "buy") into "ordered". It works on character patterns, not words.
When I Type: [sales]
I Really Mean: Extended Price
String replacements only work on strings that match at the beginning, so that In the real world, though, we'll want to make use of much more complicated substitutions. For example, when the word "sales" appears, we may want it to be ignored if used in combination with the word "quarterly", changed to "Extended Price" if followed by the word "product", but changed to "Subtotal" if followed by the word "order". The string substitution rules allow you to describe rules with this kind of if/then logic.
With string replacement, you can specify a conditional expression rather than just a replacement string. The conditional syntax is
where OP is < or > or * If the OP blocking phrase variant is used, it means, DO NOT replace the trigger text at all if the blocking phrase is found BEFORE ( < ) AFTER ( > ) or ANYWHERE ( * ) in the query. If the replacement text selected is identical to the trigger text, the substitution is ignored, so another substitution further down the list can still be performed. This explains why string triggers can be denoted by using either square brackets or quote marks. To insert a second definition of the same trigger phrase, you must change the bracketing method. To control which rule acts first, add ordering strings to the Key column (such as "A" and "B").
The context-phrase and/or the blocking phrase can also be a list of phrases, enclosed in
parens and separated by commas.
For more details on context-sensitive phrase rules, including advanced topics like creating "data-aware" substitutions, please see the Intermediate and Advanced sections of the Phrase Usage Primer. Function definition:
You can compress a complex calculation into a keyword or short phrase. It's important to understand that this technique will work only for calculations that reference symbols which Access ELF can interpret, like field names and mathematical symbols. For more complicated definitions, such as those referencing built-in library functions or your own Access Basic code, you'll need to add "Functions" to the ScriptName field, and re-run the analysis. See the Functions section of the Phrase Usage Primer for details. (The advantages of using this simpler method is that the definitions apply immediately as you type them into the Phrase window, and that fields from more than one table can be referenced. The advantage of the ScriptName=Functions method is that Access Basic functions and expressions can be included.)
Last Updated: March, 2002 |